mibo/px

PHP Library for Permissions [RBAC]
11,981
Install
composer require mibo/px
Latest Version:1.1.8
PHP:^8.2
License:MIT
Last Updated:Jun 22, 2026
Links: GitHub  ·  Packagist
Maintainer: MiBo

PX

codecov

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
visualappeal/laravel-rbac

Role based access control for Laravel 5

17,639 0
phpzen/laravel-rbac

Role based access control for Laravel 5

3,236 38
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|^12.0|^11.0|^10.0 MIT
1.1.7 ^8.2 ^12.0|^11.0|^10.0 MIT
1.1.6 ^8.2 ^11.0|^10.0 MIT
1.1.5 ^8.1 ^10.0 MIT
1.1.4 ^8.1 ^10.0