millken/ypf
Composer 安装命令:
composer require millken/ypf
包简介
PHP framework & Application Server.
README 文档
README
Overview
A micro php7 framework. in swoole mode, 10x performance can be improved.
The framework is mainly for the use of senior PHP programmers, keep everything under control.
Supports and uses various PSRs:
- PSR-2 (Coding Standard)
- PSR-4 (Autoloading)
- PSR-7 (HTTP Message)
- PSR-11 (Container Interface)
- PSR-15 (HTTP Middleware)
Installion
composer require millken/ypf
Requirements
- PHP 7.2+
- Swoole 4.2+ (Optional but recommended)
Usage
php swoole.php
//swoole.php require './vendor/autoload.php'; use GuzzleHttp\Psr7\Response; $router = new Ypf\Route\Router(); $router->map('GET', '/', function ($request) { return 'test'; }); $router->map('GET', '/hello/{name}?', function ($request) { $name = ucwords($request->getAttribute('name', 'World!')); return new Response(200, [], 'hello '.$name); }); $services = [ 'factory' => Ypf\Application\Swoole::class, 'swoole' => [ 'server' => [ 'address' => '127.0.0.1', 'port' => 7000, ], 'options' => [ 'dispatch_mode' => 1, ], ], 'middleware' => [ new Ypf\Route\Middleware($router), ], ]; $app = new Ypf\Application($services); $app->run();
swoole performance
wrk -t 20 -c 200 -d 30s "http://127.0.0.1:7000/" Running 30s test @ http://127.0.0.1:7000/ 20 threads and 200 connections Thread Stats Avg Stdev Max +/- Stdev Latency 2.16ms 1.94ms 40.97ms 88.56% Req/Sec 5.50k 521.94 19.49k 86.64% 3289431 requests in 30.10s, 501.93MB read Requests/sec: 109285.69 Transfer/sec: 16.68MB
php -S 127.0.0.1:7000 cgi.php #cgi mode
//cgi.php require './vendor/autoload.php'; use GuzzleHttp\Psr7\Response; $router = new Ypf\Route\Router(); $router->map('GET', '/', function ($request) { return 'test'; }); $router->map('GET', '/hello/{name}?', function ($request) { $name = ucwords($request->getAttribute('name', 'World!')); return new Response(200, [], 'hello '.$name); }); $services = [ 'middleware' => [ new Ypf\Route\Middleware($router), ], ]; $app = new Ypf\Application($services); $app->run();
See the full example
License
millken/ypf 适用场景与选型建议
millken/ypf 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 303 次下载、GitHub Stars 达 7, 最近一次更新时间为 2016 年 04 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「library」 「webserver」 「swoole」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 millken/ypf 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 millken/ypf 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 millken/ypf 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Fine-tuning on the PHP built-in web server.
Inbox pattern process implementation for your Laravel Applications
An minimal app http server based on PHP cli-server for use in tests
Core library that defines common interfaces used by the rest of the intahwebz..
Dockerized version of artisan serve
统计信息
- 总下载量: 303
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2016-04-13