Download the PHP package mixerapi/rest without Composer
On this page you can find all versions of the php package mixerapi/rest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mixerapi/rest
More information about mixerapi/rest
Files in mixerapi/rest
Package rest
Short Description The missing RESTful API component to CakePHP's bake console. Create RESTful API skeletions in seconds.
License MIT
Informations about the package rest
MixerApi REST
This plugin gets your API project up and going quickly by creating routes for you.
- Build your
routes.php
file from a single command or automatically expose RESTful CRUD routes with a handy AutoRouter. - Set default HTTP status codes for CRUD operations
This plugin assumes you have already created models and controllers. For help with the latter check out MixerApi/Bake. Check the official RESTful routing documentation for handling advanced routing scenarios not covered by this plugin.
Read more at MixerAPI.com.
Installation
!!! info "" You can skip this step if MixerAPI is installed.
Alternatively after composer installing you can manually load the plugin in your Application:
AutoRouter
Creating routes is already pretty easy, but AutoRouter makes building CRUD routes effortless. This is great if you are just getting started with building APIs in CakePHP.
In your routes.php
simply add \MixerApi\Rest\Lib\AutoRouter
:
This will add routes for CRUD controller actions (index, add, edit, view, and delete). If your controller does not have any CRUD methods, then the route will be skipped. AutoRouting works for plugins too:
Create Routes
While AutoRouter makes life easy, it must scan your controllers to build RESTful resources. This has a slight
performance penalty. No worry, you can use mixerapi:rest route create
to code your routes for you. This will write
routes directly to your routes.php file.
Use --prefix
to specify a prefix:
Use --plugin
for plugins:
To perform a dry-run use the --display
option:
For non-CRUD routes, sub-resources, and advanced routing please reference the CakePHP RESTful routing documentation
List Routes
This works similar to bin/cake routes
but shows only RESTful routes and improves some formatting of information.
To limit output to a specific plugin use the --plugin
option:
CRUD HTTP Status Codes
The default status codes are:
Action | Status Code |
---|---|
index | 200 |
view | 200 |
add | 201 |
edit | 200 |
delete | 204 |
To change these load a MixerApi.Rest.crud.statusCodes
configuration:
See the CakePHP documentation on loading configuration files
All versions of rest with dependencies
cakephp/cakephp Version ^4.2
nikic/php-parser Version ^4.8
thecodingmachine/class-explorer Version ^1.1