mibo/px
PX
Permissions and their evaluating. Role Based System.
Implementation
composer require mibo/px
Requirements
- PHP ^8.0
- illuminate/support ^10.0-^12.0
Usage
// Load the user that has permissions.
/** @var \MiBo\PX\Contracts\HasPermissionsInterface $user */
$user;
if ($user->hasPermission("my.own.permission")) {
// Do some action
} else {
// You may log that the user is missing required permission.
}
When implementing the interface, consider to use provided trait. If doing so,
call registerPermissions method with all available permissions for the user:
class MyUser implements \MiBo\PX\Contracts\HasPermissionsInterface
{
use \MiBo\PX\Contracts\HasPermissionsTrait;
public function __construct()
{
$this->registerPermissions(
[
"my.own.permission",
"my.another.permission"
]
);
}
}
Related Packages
santigarcor/laratrust
This package provides a flexible way to add Role-based Permissions to Laravel
6,326,552
2,275
smarch/watchtower
Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel...
2,965
52
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.1.8 | ^8.2 | ^13.0| | MIT | |
| 1.1.7 | ^8.2 | ^12.0| | MIT | |
| 1.1.6 | ^8.2 | ^11.0| | MIT | |
| 1.1.5 | ^8.1 | ^10.0 | MIT | |
| 1.1.4 | ^8.1 | ^10.0 | ||
| 1.1.3 | ^8.1 | ^10.0 | ||
| 1.1.2 | ^8.1 | ^10.0 | ||
| 1.1.1 | ^8.0 | ^9.36 | ||
| 1.1.0 | ^8.0 | ^9.36 | ||
| 1.0.0 | ^8.0 | ^9.36 |