dev-master
9999999-dev https://github.com/thomaskolmans/CleverloadA powerfull php library
MIT
The Requires
- php >=5.3,<8.0-DEV
cleverload loads
Wallogit.com
2017 © Pedro Peláez
A powerfull php library
, (*1)
A lightweight library, that takes care of your routing and file loading, (*2)
How do you install?, (*3)
You can use composer, (*4)
composer require nytrix/cleverload
Or by manually downloading it from here., (*5)
Activate Cleverload In order to have cleverload work, you have to, (*6)
.htaccess from the folder you want Cleverload to handle the request., (*7)
RewriteEngine On RewriteRule ^(.*)$ index.php [NC,L,QSA]
Or when you use a view folder to load your files, you can also use this:, (*8)
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/view/%{REQUEST_URI} -f
RewriteRule (.*) /view/$1 [R=301,L]
RewriteRule ^ index.php [L]
index.php same folder as the .htaccess., (*9)
use lib\Cleverload;
use lib\Http\Request;
use lib\Routing\Router;
require_once("autoloader.php");
$request = new Request($_SERVER);
$cleverload = new Cleverload($request);
$cleverload->getRequest()->getRouter()->getResponse();
In the routes folder, you can add files or use the existing web.php file to add routes., (*10)
We support GET, POST, PUT, PATCH, DELETE, ALL request, you can route each like so, (*11)
Route::get("/",function(){});
Route::post("/",function(){});
Route::put("/",function(){});
Route::patch("/",function(){});
Route::delete("/",function(){});
Route::all("/",function(){});
You can also return files instead of functions, your file comes from the viewdir, you can set this in your index.php by adding, (*12)
$cleverload->viewDir("/path/to/view");
Then you can return a file from there in the routes like so:, (*13)
Route::get("/","index.php");
In your router, you can also group your request, by for instance prefixes, or namespaces, or domainnames., (*14)
A powerfull php library
MIT
cleverload loads