composer require wwtg99/flight2wwu
Or, add require in composer.json "wwtg99/flight2wwu": "*"
vendor/bin/wwtinit <project_dir>
Set web directory to web and set AllowOverride to All.
Add in server
location / {
try_files $uri $uri/ /index.php;
}
Change conf files in App/config. At most time only change app_config.php.
The super class for all controllers.
The super class for all Restful controllers. Subclass must implement 7 functions.
The best super class for restful APIs. Implement all functions in RestfulController (disable create and edit), and provided 5 functions to handle resources:
And 3 attributes:
The best super class for restful view controllers. Implement all functions in RestfulController, all functions will return by view.
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 |
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
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.
200
。201
, create resource failed returning 200
and error message, server error returning 500
.201
, update resource failed returning 200
and error message, server error returning 500
。204
, delete resource failed returning 200
and error message, server error returning 500
。