Download the PHP package carlosartur/slim-auto-routing-controller without Composer
On this page you can find all versions of the php package carlosartur/slim-auto-routing-controller. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download carlosartur/slim-auto-routing-controller
More information about carlosartur/slim-auto-routing-controller
Files in carlosartur/slim-auto-routing-controller
Download carlosartur/slim-auto-routing-controller
More information about carlosartur/slim-auto-routing-controller
Files in carlosartur/slim-auto-routing-controller
Vendor carlosartur
Package slim-auto-routing-controller
Short Description Auto generate routes from class methods on slim framework.
License MIT
Package slim-auto-routing-controller
Short Description Auto generate routes from class methods on slim framework.
License MIT
Please rate this library. Is it a good library?
Informations about the package slim-auto-routing-controller
SlimAutoRoutingController
This library adds a abstract controller to auto generate routes for a slim framework project.
How to use
Install
Supported HTTP Methods
- GET
- POST
- PUT
- DELETE
- OPTIONS
- PATCH
Usage example
How it works
- To generate path
- If the controller has "ROUTE_FIXED" constant defined:
- Use value of "ROUTE_FIXED" constant as path.
- Else:
- Get the controller's name.
- Remove "Controller" word of it.
- Slugify the remaining string.
- Prefix it with value of "ROUTE_PREFIX" constant (optional).
- If the controller has "ROUTE_FIXED" constant defined:
- To generate a route:
- Searches on controller the public methods which have the word "Action" on it's name, in any part of name.
- To change the "Action" word to anything else, add a "METHOD_ROUTE_SUFFIX" constant on controller, with another word.
- To generate a "GET" action, the method must have the "GET" word inside it's name.
- To generate a "POST" action, the method must have the "POST" word inside it's name.
- To generate a "PUT" action, the method must have the "PUT" word inside it's name.
- To generate a "DELETE" action, the method must have the "DELETE" word inside it's name.
- To generate a "OPTIONS" action, the method must have the "OPTIONS" word inside it's name.
- To generate a "PATCH" action, the method must have the "PATCH" word inside it's name.
- If method's name is more than \<verb>\<suffix>:
- Remove http verb and suffix from name;
- Slugify the remaining string
- Add result of slug to path
- Searches on controller the public methods which have the word "Action" on it's name, in any part of name.
- Parameters and Validation parameter's regex:
- To add parameter, just add it on method, after "Request" and "Response" parameters.
- To validate it, 2 ways are possible
- By type:
- Add a "TYPES_REGEX" constant on your controller, or use the library default, wich validates float and int only.
- By name:
- Add a "PARAMETER_VALIDATION_REGEX" constant on your controller, or use the library default, wich validates a parameter named "id" as a integer value.
Controller
- Add a "PARAMETER_VALIDATION_REGEX" constant on your controller, or use the library default, wich validates a parameter named "id" as a integer value.
- By type:
On your routing file
Instead of doing this
It's necessary only run this
Configuration
To configure each controller individually, some constants can be used:
All versions of slim-auto-routing-controller with dependencies
PHP Build Version
Package Version
The package carlosartur/slim-auto-routing-controller contains the following files
Loading the files please wait ....