PHP code example of switon / authz

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

    

switon / authz example snippets


namespace App\Controller;

use Switon\Authorizing\Attribute\Authorize;

#[Authorize(Authorize::AUTHENTICATED)]
class ProfileController
{
    public function indexAction(): array
    {
        return ['ok' => true];
    }
}