morvren-achronos/useful
Composer 安装命令:
composer require morvren-achronos/useful
包简介
Useful is a PHP non-framework. It's a collection use utility classes. Take what you want, leave the rest.
README 文档
README
Useful is a PHP library collection with a focus on simplicity. Take what you want, ignore the rest.
Goals:
Utility
Useful provides convenience that is not easily found anywhere else.
It solves common challenges that are not well addressed by the PHP language, common frameworks or popular libraries.
Simplicity
Useful can be used quickly without lots of reading and training.
Class hierarchy is flat. Each class does one thing. All classes are immediately useful to application developers.
Easy integration
Useful does not require you to do anything in one particular way.
It has few dependencies, and dependencies are clearly marked. Every class stands on its own and can be used on its own.
Requirements
PHP 5 >= 5.4 or PHP 7; or PHP 5 >= 5.0 with special handling (see No namespaces below).
Most classes should work anywhere that PHP does. Exceptions are clearly marked.
Installation
Composer
Useful supports Composer. If you do too, great, install Useful using it and go.
Example:
Manual
You can clone from Github, or just copy in the files.
Clone from Github:
git clone https://github.com/morvren-achronos/php-useful.git WHEREVER_YOU_PUT_VENDOR_CODE/useful
You can even paste in a single class; Useful classes have no interdependencies, so if you only want one just take it and use it.
Usage
Composer autoload
If you use Composer then Useful code will autoload automatically. All classes are in the \Useful namespace.
Example:
// Create a Useful Date object $oDate = \Useful\Date::create('1999-12-31');
Include Useful's autoloader
// Load Useful autoloader directly require_once('WHEREVER_YOU_PUT_VENDOR_CODE/useful/src/autoloader.php'); // Create a Useful Date object $oDate = \Useful\Date::create('1999-12-31');
It's a simple PSR-4 autoloader for the \Useful namespace.
No namespaces: Legacy loader
Useful supports PHP 5 back to (in theory) 5.0 via its "legacy loading" system.
Note, the test suite requires PHP 7. Author has used parts of Useful on PHP 5.1. Your mileage may vary.
PHP 5.1-compatible SPL autoloader
// Load Useful legacy autoloader require_once('WHEREVER_YOU_PUT_VENDOR_CODE/useful/src/legacy_autoloader.php'); // Create a Useful Date object $oDate = Useful_Date::create('1999-12-31');
The legacy autoloader uses a classname prefix (Useful_Foo) instead of namespace (\Useful\Foo).
PHP 5.0 loader
PHP 5.0 does not have spl_autoload_register(). That's ok. The legacy loader can be used to load a class directly without namespace.
// Load Useful_Legacy_Loader class require_once('WHEREVER_YOU_PUT_VENDOR_CODE/useful/src/Useful_Legacy/Loader.php'); Useful_Legacy_Loader::registerNamespace( '\Useful', 'WHEREVER_YOU_PUT_VENDOR_CODE/useful/src/Useful', 'WRITABLE_TEMP_DIRECTORY_FOR_CODE_CACHING/' ); function __autoload($sClass) { // Try Useful legacy loader, it will return FALSE if not handled. // You could also just call this method directly for each class you want, without an autoloader. if (Useful_Legacy_Loader::loadClass($sClass)) { return; } // ... whatever else you need to autoload } // Create a Useful Date object $oDate = Useful_Date::create('1999-12-31');
Tests
Uses PHPUnit. Test coverage is [2019-04] @TODO very incomplete for some classes.
morvren-achronos/useful 适用场景与选型建议
morvren-achronos/useful 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 57 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 morvren-achronos/useful 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 morvren-achronos/useful 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 57
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2019-09-30