guanhui07 / facade
facade
v1.1.0
2023-02-05 23:57 UTC
Requires
- php: >=7.4.0
- php-di/php-di: ^6.4
README
composer require guanhui07/facade
用法
$container = Container::instance(); FacadeFactory::setContainer($container);
创建和使用外观
外观应该是 AbstractFacade 的一个实例,并且应该提供一个访问器。
访问者是服务标识符。它将用于获取容器中的服务。
class TestFacade extends AbstractFacade { protected static function accessor() { return TestService::class; } }
调用服务实例
$service = TestFacade::instance();
调用服务方法
TestFacade::someMethod();
或者
$service = TestFacade::instance(); $service->someMethod();
我的其他包:
https://github.com/guanhui07/dcr 借鉴Laravel实现的 PHP 框架,FPM模式、websocket使用的workerman、支持容器、PHP8特性attributes实现了路由注解、中间件注解、Laravel Orm等特性
https://github.com/guanhui07/redis Swoole模式下 Redis 连接池
https://github.com/guanhui07/facade facade、门面 fpm模式下可使用
https://github.com/guanhui07/dcr-swoole-crontab 基于 swoole 实现的 crontab 秒级定时任务
https://github.com/guanhui07/database 基于 illuminate/database 做的连接池用于适配 Swoole 的协程环境
https://github.com/guanhui07/dcr-swoole 高性能 PHP 框架,Cli 模式,基于 Swoole 实现,常驻内存,协程框架,支持容器、切面、PHP8特性attributes实现了路由注解、中间件注解、支持 Laravel Orm 等特性
https://github.com/guanhui07/open-ai open-ai ChatGPT 调用