PHP code example of ricventu / laravel-route-maze

1. Go to this page and download the library: Download ricventu/laravel-route-maze 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/ */

    

ricventu / laravel-route-maze example snippets


class ProductsController
{
    // index and __invoke defaults to GET
    public function index() {...}
    #[Get]
    public function show($id) {...}
    #[Post]
    public function store(Request $request) {...}
    #[Patch]
    public function update($id, Request $request) {...}
    #[Delete]
    public function destroy($id) {...}
}

    Route::maze(app_path('Http/Controllers'), 'App\\Http\\Controllers');

    Route::get('/some-category/products', 'SomeCategory\ProductsController@index')->name('some-category.products');
    Route::get('/some-category/products/show/{id}', 'SomeCategory\ProductsController@show')->name('some-category.products.show');
    Route::post('/some-category/products/store', 'SomeCategory\ProductsController@store')->name('some-category.products.store');
    Route::Patch('/some-category/products/update/{id}', 'SomeCategory\ProductsController@update')->name('some-category.products.update');
    Route::delete('/some-category/products/destroy/{id}', 'SomeCategory\ProductsController@destroy')->name('some-category.products.destroy');

class ItemsController
{
    #[Get]
    public function get($id) {...}
}

    Route::get('/{param1}/items/get/{id}', 'ItemsController@get')->name('items.get');

return [
    'auth',
];

return [
];


## Installation

You can install the package via composer:


    Route::maze(app_path('Http/Controllers'), 'App\\Http\\Controllers');