https://github.com/guanhui07/facade
facade、门面,借鉴laravel的门面,实现原理:__callStatic魔术方法
https://github.com/guanhui07/facade
facade laravel php static
Last synced: 6 months ago
JSON representation
facade、门面,借鉴laravel的门面,实现原理:__callStatic魔术方法
- Host: GitHub
- URL: https://github.com/guanhui07/facade
- Owner: guanhui07
- License: mit
- Created: 2023-01-01T03:03:46.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-23T14:39:27.000Z (about 1 year ago)
- Last Synced: 2025-03-03T16:11:34.436Z (7 months ago)
- Topics: facade, laravel, php, static
- Language: PHP
- Homepage: https://packagist.org/packages/guanhui07/facade
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
## 安装
`composer require guanhui07/facade`## 用法
```php
$container = Container::instance();
FacadeFactory::setContainer($container);
```## 创建和使用外观
Facade 应该是 AbstractFacade 的一个实例,并且应该提供一个访问器。访问者是服务标识符。它将用于获取容器中的服务.
```php
class TestFacade extends AbstractFacade
{protected static function accessor()
{
return TestService::class;
}
}
```## 调用服务实例
```php
$service = TestFacade::instance();
```### 调用服务方法
```php
TestFacade::someMethod();
```或者
```php
$service = TestFacade::instance();
$service->someMethod();
```## 我的其他包:
https://github.com/guanhui07/dcr 借鉴Laravel实现的 PHP Framework ,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 Framework ,Cli模式,基于Swoole实现,常驻内存,协程框架,支持容器、切面、PHP8特性attributes实现了路由注解、中间件注解、支持Laravel Orm等特性
https://github.com/guanhui07/open-ai open-ai chatgpt调用