PHP code example of hamedbahrami / enhanced-router

1. Go to this page and download the library: Download hamedbahrami/enhanced-router library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hamedbahrami / enhanced-router example snippets


Route::on('post', 'csrf');

Route::on(['post', 'put'], 'csrf');

Route::on(['post', 'put'], ['csrf', 'auth']);

Route::group(array('prefix' => '{locale}'), function()
{
    Route::controller('auth', 'AuthController');
    
    Route::bunch(function()
    {
        Route::get('/', 'UserController@profile');
        
        Route::group(array('domain' => 'admin.laravel.dev'), function()
        {
            Route::resource('posts', 'AdminPostsController');

            Route::controller('/', 'AdminController');
        });
    })->before('auth');
})->where('locale', '(en|fr)');

'providers' => array(
    'Hamedbahrami\EnhancedRouter\EnhancedRouterServiceProvider'
)

Route::get('{locale}/about', function($locale)
{

})->where('locale', '(en|fr)');

Route::get('{locale}', function($locale)
{
    return 'Homepage';
})->where('locale', '(en|fr)');

Route::group(array('prefix' => '{locale}'), function()
{
    Route::get('about', function($locale)
    {

    });

    Route::get('/', function($locale)
    {
        return 'Homepage';
    });
})->where('locale', '(en|fr)');

Route::group(array('domain' => 'example.laravel.dev'), function()
{

});

Route::group(array('domain' => '{user}.laravel.dev'), function()
{

});

Route::group(array('domain' => '{user}.laravel.dev'), function()
{

})->where('user', '(jason|shawn)');

Route::group(array(), function()
{

})->before('auth');

Route::group(array(), function()
{
    Route::group(array(), function()
    {

    })->before('csrf');
})->before('auth');

Route::bunch(function()
{

})->before('auth');