2017 © Pedro Peláez
 

library routing

URL Request Router

image

appzcoder/routing

URL Request Router

  • Tuesday, September 29, 2015
  • by appzcoder
  • Repository
  • 1 Watchers
  • 4 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

URL Request Router

URL Request Router, (*1)

Installation

  1. Run, (*2)

    composer require appzcoder/routing:"dev-master"
    
  2. Add bellow lines to your script, (*3)

    require 'vendor/autoload.php';
    

Usage

// Make Route alias of Route Facade for static instance calling
class_alias('Appzcoder\Routing\RouterFacade', 'Route');

// Set your own controller namespace (optional)
Route::setControllerNamespace("App\\Controllers\\");

// GET Route with anonymous function
Route::get('/', function () {
    return 'Hello World';
});

// Route with name parameter
Route::get('/demo/hello/{name}', 'MyController#getHello');

// Route with name and id both parameters
Route::get('/demo/hello/{id}/me/{name}', 'MyController#getHello');

// POST Verb Route
Route::post('/demo', 'MyController#getIndex');

// Controller Route
Route::controller('/my', 'MyController');

// RESTfull Resource Route
Route::resource('/person', 'PersonController');

// Group Route
Route::group(['prefix' => 'admin', 'namespace' => 'Admin'], function () {
    Route::get('/users', function () {
        return "/admin/users";
    });

    Route::get('/teachers', function () {
        return "/admin/teachers";
    });

    Route::get('/dashboard', 'AdminController#getIndex');
});

// Finally execute or dispatch your route to your desire cotroller method or callback
Route::execute();

Author

Sohel Amin, (*4)

The Versions

29/09 2015

dev-master

9999999-dev

URL Request Router

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • appzcoder/alias-maker dev-master

 

routing router url router