geekish/slimbox
Composer 安装命令:
composer require geekish/slimbox
包简介
Slim Framework with Unbox container
README 文档
README
Bringing mindplay/unbox into Slim Framework.
Install
Via Composer:
composer require geekish/slimbox
Usage
Service Provider
The most important class in this package is Geekish\Slimbox\DefaultServicesProvider.
It ensures the same services required by Slim are available through Unbox.
Besides the change in container, it differs from Slim\DefaultServicesProvider by registering services under their FQCN first, then registers aliases by their interfaces, and finally the short aliases used by slim (e.g. "router", "foundHandler"). Registering services by their class name enables Unbox to automatically inject them as dependencies as needed by other classes.
The service provider is not automatically registered for you, so you need to do this yourself:
use Geekish\Slimbox\DefaultServicesProvider; use mindplay\unbox\ContainerFactory; $factory = new ContainerFactory; $factory->add(new DefaultServicesProvider); $container = $factory->createContainer();
Settings
Also included is Geekish\Slimbox\Settings, which extends from Slim\Collection. This class replaces the simple array that Slim registers under "settings" (see: Slim Default Settings).
Settings may be provided via the constructor of the DefaultServicesProvider:
$factory->add(new DefaultServicesProvider([ "outputBuffering" => "prepend", ]));
Or via the configure() method on ContainerFactory:
$factory->configure( Settings::class, function (Settings $settings) { $settings['displayErrorDetails'] = true; return $settings; } );
Container and Container Factory (Optional)
This package contains an extended (final) Container and ContainerFactory from Unbox. Usage is almost exactly the same as using Unbox directly, except the extended Container partially implements ArrayAccess. This allows you to use the Container like an array to access services; however, due to the fact that Unbox uses a factory class to create the container, you cannot use array notation to set/configure services on the Container.
To use the extended ContainerFactory:
use Geekish\Slimbox\ContainerFactory; use Geekish\Slimbox\DefaultServicesProvider; use Slim\App; $factory = new ContainerFactory; $factory->add(new DefaultServicesProvider([ "outputBuffering" => "prepend", ])); $container = $factory->createContainer();
Usage of the packaged Container and ContainerFactory is entirely optional; they are included purely for convenience and consistency with Slim's packaged Container. Simply replace Geekish\Slimbox\ContainerFactory in the snippet above with mindplay\unbox\ContainerFactory.
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email hannahwarmbier@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
geekish/slimbox 适用场景与选型建议
geekish/slimbox 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 90 次下载、GitHub Stars 达 4, 最近一次更新时间为 2016 年 11 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「geekish」 「slimbox」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 geekish/slimbox 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 geekish/slimbox 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 geekish/slimbox 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 90
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-12