linkorb/autotune
Composer 安装命令:
composer require linkorb/autotune
包简介
Tune your autoloader
README 文档
README
Why use AutoTune for Composer?
AutoTune is great for library developers.
Often you're working on a library and the calling application at the same time.
Before AutoTune there were 2 things you could do to test your library in your application:
- Commit new version of the library for all changes, wait for packagist to re-index, and update your composer.lock in the calling application and test.
- Add a "repository" to your calling application's composer.json (which you shouldn't forget to remove during commit, and put back after)
Both are cumbersome. This is where AutoTune comes in!
How does autotune work?
AutoTune expects to find a autotune.json in your calling application's path, next to composer.json. Here's an example:
{
"autoload": {
"psr-4": {
"Monolog\\": "~/git/monolog/monolog/src/Monolog"
}
}
}
If this file is found, it will read the contents, and override any psr-0 or psr-4 namespaces with the local version as defined in your autotune.json file.
You can add the autotune.json to your .gitignore file, so that you can keep your code directory clean and in sync with the remote repository.
Making your own application ready for AutoTune
Making your own application ready for AutoTune takes 3 simple steps:
1. Include linkorb/autotune from Packagist in your composer.json file
require-dev": { "linkorb/autotune": "~1.0" }
Then run composer update
2. Initialize AutoTune in your app
Somewhere in your application, you're including vendor/autoload.php. Sometimes it's in web/index.php or bin/console. Find this location, and modify add these lines:
$loader = require_once __DIR__.'/../vendor/autoload.php'; if (class_exists('AutoTune\Tuner')) { \AutoTune\Tuner::init($loader); }
Wrapping the call to init in the class_exists block ensures autotune is only used if AutoTune is installed in your (development) environment (installed from the require-dev block in composer.json). In production environments it won't be called if you install your dependencies with --no-dev)
3. Add an autotune.json file to your project root.
Example content:
{
"autoload": {
"psr-4": {
"Monolog\\": "~/git/monolog/monolog/src/Monolog"
}
}
}
Ideally you'd add the autotune.json to your .gitignore file.
Done
Whenever your application is doing something like the following, it will load the "local" version of a library, instead of the one in your vendor/ directory.
$logger = new \Monolog\Logger('example');
So from now on, no changes are required to your main application. Everything is managed by your local autotune.json file.
License
MIT (see LICENSE.md)
Brought to you by the LinkORB Engineering team
Check out our other projects at linkorb.com/engineering.
Btw, we're hiring!
linkorb/autotune 适用场景与选型建议
linkorb/autotune 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.5k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2016 年 01 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「autoloader」 「autoload」 「composer」 「packagist」 「tune」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 linkorb/autotune 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 linkorb/autotune 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 linkorb/autotune 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Environment processor and contexts autoloader
An package to make it easy to autoload code.
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
Extension to autoload modules dynamically
Class loader implementation (PSR-0, PSR-4)
统计信息
- 总下载量: 7.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 13
- 依赖项目数: 17
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-01-17