2017 © Pedro Peláez
 

library cleverload

A powerfull php library

image

nytrix/cleverload

A powerfull php library

  • Monday, February 26, 2018
  • by thomaskolmans
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

, (*1)

Cleverload

A lightweight library, that takes care of your routing and file loading, (*2)

Installation

How do you install?, (*3)

You can use composer, (*4)

composer require nytrix/cleverload

Or by manually downloading it from here., (*5)

Usage

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)

Routes

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");

Groups

In your router, you can also group your request, by for instance prefixes, or namespaces, or domainnames., (*14)

The Versions

26/02 2018

dev-master

9999999-dev https://github.com/thomaskolmans/Cleverload

A powerfull php library

  Sources   Download

MIT

The Requires

  • php >=5.3,<8.0-DEV

 

cleverload loads