PHP code example of suitetea / quick-routes
1. Go to this page and download the library: Download suitetea/quick-routes 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/ */
suitetea / quick-routes example snippets
Route::get('users', 'UserController@index');
Route::post('users', array(
'as' => 'user.create',
'uses' => 'UserController@create'
));
Route::post('users/{id}', array(
'as' => 'user.edit',
'uses' => 'UserController@update'
))->where(array(
'id' => '[0-9]+'
));
Route::get('users/{id}/delete', array(
'as' => 'user.delete',
'uses' => 'UserController@delete'
))->where(array(
'id' => '[0-9]+'
));
Route::get('tweets', 'TweetController@index');
Route::post('tweets', array(
'as' => 'tweet.create',
'uses' => 'TweetController@create'
));
Route::post('tweets/{id}', array(
'as' => 'tweet.edit',
'uses' => 'TweetController@update'
))->where(array(
'id' => '[0-9]+'
));
Route::get('tweets/{id}/delete', array(
'as' => 'tweet.delete',
'uses' => 'TweetController@delete'
))->where(array(
'id' => '[0-9]+'
));
$default_routes = [
'index' => [
'pattern' => '/',
],
'create' => [
'pattern' => 'create',
'methods' => ['get','post']
]
];
$image_routes = [
'img_create' => [
'pattern' => 'create/image'
'methods' => ['post']
]
];
QuickRoutes::register('users', '*', array_merge($default_routes, $image_routes));
php artisan config:publish suitetea/quick-routes