Download the PHP package nabeelalihashmi/apilot-engine without Composer
On this page you can find all versions of the php package nabeelalihashmi/apilot-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nabeelalihashmi/apilot-engine
More information about nabeelalihashmi/apilot-engine
Files in nabeelalihashmi/apilot-engine
Package apilot-engine
Short Description Simple endpoint-in-files router for PHP
License MIT
Informations about the package apilot-engine
Apilot
Fast automatic files based router with Caching routes
WARNING
Design api carefully
Installation
Using Composer
Manual
Just download the Apilot.php
file, include in your project. Configure .htaccess
.
.htaccess files
- Copy extras/root.htaccess in root folder and rename it to .htaccess.
- Copy extras/public.htaccess in public folder and rename it to .htaccess.
Routes
Make a folder for handlers. Each file in that cockpit folder corresponds to a route.
e.g.
Each file must have at least one handler method. The name of the method must be handle
.
e.g.
Dynamic routes
To make a route accept dynamic value, use :
in the route.
e.g.
Optional Parameters
To make a route optional, make the parameter optional with ?
.
Rules
- Optional Routes must place at end
Middleware
You can use middleware to do something before and after the route. You can use before
and after
appended to handler method name. before middleware must return true to continue.
Route Not Found
Apilot will call the on404
function if the route is not found. You can use this function to redirect to 404 page or do something else.
usage: