承接 stagem/class-finder 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

stagem/class-finder

最新稳定版本:1.0

Composer 安装命令:

composer create-project stagem/class-finder

包简介

Extremely simple and fast Class Finder

README 文档

README

Extremely simple and fast Class Finder.

The package allows you to get Fully Qualified Class Name (FQCN) from file or directory path. There are no dependencies on the Composer Autoloader, Reflection, RegEx, or get_declared_classes().

Many similar packages already implement this functionality but all of them suffer from overengineering or performance issues. When your project becomes big and it has tens of thousands of classes with the huge numbers of config you need a simple and fast solution to operate all of it.

Installation

Use Composer to install this library in your projects:

$ composer require stagem/class-finder

Usage

Find in file path

<?php

use Stagem\ClassFinder\ClassFinder;

$class = (new ClassFinder())->getClassFromFile('/path/to/App/ClassName.php');

var_dump($class);
// App\ClassName

Find in directory path

<?php 

use Stagem\ClassFinder\ClassFinder;

$classes = (new ClassFinder())->getClassesInDir('/path/to/App/Model');

var_dump($classes);
/**
 *  array (
 *    0 => '\\App\\Model\\Product',
 *    1 => '\\App\\Model\\Cart',
 *    2 => '\\App\\Model\\Order',
 *    3 => '\\App\\Model\\Shipment',
 *  )
 */  

统计信息

  • 总下载量: 9.22k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-10