wwtg99/flight2wwu
Composer 安装命令:
composer require wwtg99/flight2wwu
包简介
PHP framework depends on Flight
关键字:
README 文档
README
Installation
Use composer to install
composer require wwtg99/flight2wwu
Or, add require in composer.json "wwtg99/flight2wwu": "*"
Use command tool wwtinit (vendor/bin) to initialize project
vendor/bin/wwtinit <project_dir>
Config Apache
Set web directory to web and set AllowOverride to All.
Config Nginx
Add in server
location / {
try_files $uri $uri/ /index.php;
}
Config framework
Change conf files in App/config. At most time only change app_config.php.
Directories
- App: application directory
- config: config files
- lang: translation files
- Controller: controller class
- Model: model class
- view: view templates
- Plugin: plugin class
- config: config files
- bootstrap: bootstrap scripts
- storage: storage directory, write access
- log: default log directory
- tmp: default tmp directory (ex. config cache file)
- web: web document root
Controllers
BaseController
The super class for all controllers.
RestfulController
The super class for all Restful controllers. Subclass must implement 7 functions.
- index: URI /resources Method Get, list all resources
- show: URI /resources/{id} Method Get, get one resource by id
- create: URI /resources/create Method Get, view to create resource, used for restful+
- store: URI /resources Method Post, create resource
- edit: URI /resources/{id}/edit Method Get, view to update resource, used for restful+
- update: URI /resource/{id} Method Put/Patch, update resource, Put to update all data (null for data not provided), Patch to update provided data
- destroy: URI /resource/{id} Method Delete, delete resource
RestfulAPIController
The best super class for restful APIs. Implement all functions in RestfulController (disable create and edit), and provided 5 functions to handle resources:
- listResources: list resources
- getResource: get one resource
- createResource: create resource
- updateResource: update resource
- deleteResource: delete resource
And 3 attributes:
- filterFields: fields to filter
- createFields: fields for creation
- updateFields: fields for update
RestfulPlusController
The best super class for restful view controllers. Implement all functions in RestfulController, all functions will return by view.
RestFul APIs Definition
Resource URI,represent one resource, example: http://example.com/resources/
If have errors, error message will be provided as {"error": "message", "code": 1} .
URIs and Methods(zoos as example):
| Method | URI | Action |
|---|---|---|
| GET | /zoos | get resource list |
| POST | /zoos | create resource |
| GET | /zoos/{id} | get resource by id |
| PUT | /zoos/{id} | update resource by id (must provided all fields) |
| PATCH | /zoos/{id} | update resource by id (provided partial fields) |
| DELETE | /zoos/{id} | delete resource by id |
Paging、Order and Filters
Get resource list support paging, order and filters.
Paging:
Method one:
page: page number page_size: number per page, optional, default 100 Example: ?page=1&page_size=100
Method two:
limit: number limitation offset:number offset, optional, default 0 Example: ?limit=100&offset=10
Order:
Use sort parameter, >field to sort by field ascending, <field to sort by field descending, use comma (,) to separate fields, Example: ?sort=>name,<age
Filters:
Use expression to filter, supported expression: =, >=, <=, !=。 Example:?name=Tom ?age>=10 ?name!=Tim
Selected fields
Get resource list and get one resource support select fields. Use fields parameters, comma (,) to separate. Example: ?fields=name,age,dob,pob If fields is count, then show number of data.
Return HTTP code
- GET return
200。 - POST create resource successfully returning
201, create resource failed returning200and error message, server error returning500. - PUT/PATCH update resource successfully returning
201, update resource failed returning200and error message, server error returning500。 - DELETE delete resource successfully returning
204, delete resource failed returning200and error message, server error returning500。
wwtg99/flight2wwu 适用场景与选型建议
wwtg99/flight2wwu 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 02 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「mvc」 「flight」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 wwtg99/flight2wwu 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wwtg99/flight2wwu 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 wwtg99/flight2wwu 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Kinikit - PHP Application development framework MVC component
This Bundle provides a wrapper for the FlightStats API
Tidy session library for Flight PHP
Mustache template library wrapper for the Flight microframework
Small extensible framework in PHP
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-02-14