PHP code example of riesenia / cakephp-routing

1. Go to this page and download the library: Download riesenia/cakephp-routing 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/ */

    

riesenia / cakephp-routing example snippets



namespace App\Controller;
use Riesenia\Routing\Attribute\Resources;

#[Resources(only: ['index', 'view'])]
class AuthorsController extends AppController
{
}


namespace App\Controller;
use Riesenia\Routing\Attribute\Connect;

class AuthorsController extends AppController
{
    #[Connect(uri: 'cool-author')]
    public function index()
    {
        // Controller logic for /authors/cool-author
    }

    #[Connect(uri: '/custom-author')]
    public function custom()
    {
        // Controller logic for /custom-author
    }
}

$builder->connect('/authors/cool-author', 'Authors::index',[]);
$builder->connect('/custom-author', 'Authors::custom',[]);