定制 oliver-hader/composer-class-finder 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

oliver-hader/composer-class-finder

Composer 安装命令:

composer require oliver-hader/composer-class-finder

包简介

State-agnostic class files finder, based on Composer autoload information, without actually applying autoloader in PHP process.

README 文档

README

State-agnostic class files finder, based on Composer autoload information, without actually applying autoloader in PHP process. The scope of this package is to retrieve the file location for classes of particular Composer-based projects.

This way classes can be resolved standalone without actually loading them into memory, since class loading is not invoked at all.

Plain Composer

<?php
require_once __DIR__ . '/vendor/autoload.php';

$directory = '/other/project/vendor';
$finder = \OliverHader\ComposerClassFinder\TYPO3::resolveFinder($directory);
$filePath = $finder->findFile('Vendor\\Project\\Some\\Utility');

TYPO3 specific

resolving composer-mode of a project

This basically resolves information concerning TYPO3 "composer-mode".

$bool = \OliverHader\ComposerClassFinder\TYPO3::isComposerMode($directory);
  • $directory set to location of root composer.json returns true (given there actually is a valid TYPO3 composer-based installation)
  • $directory set to location to web-root (containing index.php and typo3conf/autoload/) returns false

applying corresponding autoload information

Same rules as in previous composer-mode section apply for $directory. The library won't do much directory traversing - exceptions are thrown when providing invalid directories. Thus, it's your job to provide correct values.

Information is fetched from either composer-based data (just vendor/) or in non-composer-mode from <typo3_src>/vendor/ and <web-root>/typo3conf/autoload/.

$finder = \OliverHader\ComposerClassFinder\TYPO3::resolveFinder($directory);
$filePath = $finder->findFile('BK2K\\BootstrapPackage\\Backend\\ToolbarItem\\VersionToolbarItem');

Thanks to Composer Folks

Basically this package is just a wrapper for existing Composer class-loader, the corresponding code has been duplicated from https://github.com/composer/composer.

Thanks a bunch for your great work! 👍

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固