snapflowio/framework
最新稳定版本:v0.1.0
Composer 安装命令:
composer require snapflowio/framework
包简介
A simple and lightweight framework for building PHP apps with Snapflow libraries.
README 文档
README
A simple and lightweight framework for building PHP apps with Snapflow libraries.
Installation
composer require snapflowio/framework
Quick Start
<?php use Snapflow\Framework\{Framework, Module, Service, Action}; use Snapflow\HTTP\DI\Container; use Snapflow\HTTP\Http; use Snapflow\HTTP\Response; use Snapflow\HTTP\Swoole\Server; class HelloAction extends Action { public function __construct() { $this->setHttpMethod(self::METHOD_GET) ->setHttpPath('/') ->inject('response') ->callback(fn(Response $response) => $response->json(['message' => 'Hello World']) ); } } class ApiService extends Service { public function __construct() { $this->setType(self::TYPE_HTTP); $this->addAction('hello', new HelloAction()); } } class AppModule extends Module { public function __construct() { $this->addService('api', new ApiService()); } } class AppFramework extends Framework {} $app = new AppFramework(new AppModule()); $app->init('http'); $server = new Server('0.0.0.0', 8080); $container = new Container(); $http = new Http($server, $container, 'UTC'); echo "Server starting on http://localhost:8080\n"; $http->start();
License
This library is available under the MIT License.
Copyright
Copyright (c) 2025 Snapflow
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-16