ed.suharev/slick-framework
Composer 安装命令:
composer require ed.suharev/slick-framework
包简介
Simple PHP 5.3 compatible framework based off Slim 2 Framework and RKA Controller
README 文档
README
This framework is based off the Slim Framework, but adds some conveniences, like the ability to instantiate controllers with action methods wherever you would use a closure when routing (this feature came directly from rka-slim-controller).
The controller can optionally be loaded from DI container, allowing you to inject dependencies as required.
Mostly this copy-pastes and rewrites only base Slim app class, so this still depends on Slim2 framework. It requires PHP 5.3 at least, assumes that you install it with composer and use Composer's autoloader.
Additional to Slim2 features
- Configuring routes with Yaml file
- Support for Controller classes in routing config
Installation
composer require ed-sukharev/slick-framework
Usage
Use the string format {controller class name}:{action method name}
wherever you would usually use a closure:
e.g.
$app = new \Slick\Slick();
$app->get('/hello:name', 'App\IndexController:home');
You can also register the controller with Slim's DI container:
$app = new \Slick\Slick();
$app->container['App\IndexController'] = function ($container) {
// Retrieve any required dependencies from the container and
// inject into the constructor of the controller
return new \App\IndexController();
};
$app->get('/', 'App\IndexController:index');
Controller class methods
Just as Slim does, Slick passes controller actions it's arguments. Additionally, if the first argument of controller
action is type hinted as \Slim\Http\Request, then actual request will be passed in as first parameter, and then the
rest of Slim parameters.
Slick assumes that you inject all dependencies into your controller inside DI container. For that rare case when you
still need DI container, Slick provides \Slick\ContainerAwareInterface, which you may implement in controller,
or better yet, extend you controller from \Slick\SlickController.
Slick will set PSR-11 compatible DI container into it.
ed.suharev/slick-framework 适用场景与选型建议
ed.suharev/slick-framework 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「controller」 「php5.3」 「slim」 「slick」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ed.suharev/slick-framework 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ed.suharev/slick-framework 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ed.suharev/slick-framework 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Give your JS App some Backbone with Models, Views, Collections, and Events.
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Create mail from controller action render
Extended auth components for Yii2
A simple PSR-7 based HTTP middleware queue
A Yii2 extension that includes the concept of roles in the framework. Useful to handle user access to controllers actions allowed only for some roles and filter database resources.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-03-23