boleiros / guardian
ACL plugin for CakePHP 3.x
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- php: >=5.5.9
- cakephp/cakephp: >=3.3.2 <4.0.0
Requires (Dev)
- cakephp/migrations: ^1.6
- phpunit/phpunit: *
This package is auto-updated.
Last update: 2025-03-01 00:11:22 UTC
README
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require boleiros/guardian
Enable Plugin
// config/bootstrap.php Plugin::load('Guardian', ['bootstrap' => true, 'routes' => true]);
Or, in your terminal:
bin/cake plugin load -b -r Gardian
Run Migrations
bin/cake migrations migrate --plugin Guardian
Usage
- import and use the Guardian Trait on your user Model
//User.php
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
use Guardian\Model\Traits\Guardian;
class User extends Entity
{
use Guardian;
....
- call the method passing the name of the permission:
$user->hasPermission('users.index')