Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 744 Bytes

README.md

File metadata and controls

32 lines (24 loc) · 744 Bytes

marko/authorization

Gates, policies, and the #[Can] attribute -- control who can do what with expressive, testable authorization checks.

Installation

composer require marko/authorization

Quick Example

use Marko\Authorization\Attributes\Can;
use Marko\Routing\Attributes\Get;
use Marko\Routing\Http\Response;

class AdminController
{
    // Enforced on every request once the package is installed: 401 if logged out, 403 if denied
    #[Get('/admin')]
    #[Can('admin.access')]
    public function dashboard(): Response
    {
        return new Response('Welcome');
    }
}

Documentation

Full usage, API reference, and examples: marko/authorization