fuelphp/alias
最新稳定版本:2.0.0
Composer 安装命令:
composer require fuelphp/alias
包简介
Class alias resolving.
关键字:
README 文档
README
Library for lazy class aliasing.
Install
Via Composer
$ composer require fuelphp/alias
Usage
Within FuelPHP class aliases are used to provide easy access to namespaced classes and facilitate class inheritance injection.
The package exposes an alias manager which lets you create 3 types of aliases:
- Literal
A one-to-one translation. Class "Namespaced\Classname" translates to "Another\Classname". - Namespace
Namespace aliases allow you to alias an entire namespace with one call. - Replacement
A pattern is matched an through replacements a new class is generated. "Namespace\*" maps to "Alias\$1".
When registering the alias manager append or prepends itself to the autoload stack to act as a pre-processor or fallback. Depending on the amount of aliases and it could be beneficial to alternate between pre- or appending.
By default the manager will prepend itself to the autoloader stack.
Basic Usage
// Create a new alias manager $manager = new Fuel\Alias\Manager; // Register the manager $manager->register(); // Alias one class $manager->alias('Alias\Me', 'To\This'); // Or alias many $manager->alias([ 'Alias\This' => 'To\Me', 'AndAlias\This' => 'To\SomethingElse', ]); //
Namespace usage
// alias to a less deep namespace $manager->aliasNamespace('Less\Deep', 'Some\Super\Deep\Name\Space'); // alias a namespace to global $manager->aliasNamespace('Some\Space', '');
Pattern Usage
$manager = new Fuel\Alias\Manager; // Alias with wildcards $manager->aliasPattern('Namespaced\*', 'Other\\$1'); $otherThing = new Namespaced\Thing;
This can result into class resolving that doesn't exists. Luckily the package is smart enough the check wether the class exists and will continue to look for the correct class if the resolved class does not exist. This is also taken into account when it comes to caching. Only resolved classes that exist will be cached.
Contributing
Thank you for considering contribution to FuelPHP framework. Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.
fuelphp/alias 适用场景与选型建议
fuelphp/alias 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37.39k 次下载、GitHub Stars 达 20, 最近一次更新时间为 2012 年 12 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「alias」 「Aliassing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fuelphp/alias 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fuelphp/alias 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fuelphp/alias 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
An easy to use PSR-11 compatible dependency injection container.
Database alias router extension for Nette Framework
Yii2 eXeCUT alias
Save keystrokes and run Artisan commands your way
统计信息
- 总下载量: 37.39k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 31
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-12-18