PHP code example of netmex / laravel-attributes

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

    

netmex / laravel-attributes example snippets


// config/app.php
'providers' => [
    // ...
    Netmex\Attributes\Route\AttributesRouteServiceProvider::class,
];

use Netmex\Laravel\Attributes\Route;

final class PostController
{
    #[Route(path: '/posts', name: 'posts.index', methods: ['GET'])]
    public function index()
    {
        // controller action
    }

    #[Route(path: '/posts/{id}', name: 'posts.show', methods: ['GET'], 

use Netmex\Laravel\Attributes\Route;

#[Route(path: '/admin', name: 'admin.', middleware: ['auth'])]
final class Admin\DashboardController
{
    #[Route(path: '/dashboard', name: 'dashboard')]
    public function index() {}
}
bash
php artisan attributes-route:clear