Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 607 Bytes

File metadata and controls

28 lines (19 loc) · 607 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\Contracts\GateInterface;

// Define an ability
$gate->define(
    'edit-settings',
    fn (?AuthorizableInterface $user) => $user?->can('admin', true) ?? false,
);

// Check it
$gate->authorize('edit-settings');

Documentation

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