{"repo":"php-casbin/laravel-authz","free":true,"listed":false,"github":"https://github.com/php-casbin/laravel-authz","clone":"git clone https://github.com/php-casbin/laravel-authz.git","description":"An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.","language":"PHP","stars":337,"topics":["laravel","casbin","permissions","authorization","access-control","passport","middleware","abac","acl","gate"],"license":"Apache-2.0","category":"auth-billing-email","readme_excerpt":"Laravel Authorization Laravel-authz is an authorization library for the laravel framework. It's based on Casbin, an authorization library that supports access control models like ACL, RBAC, ABAC. All you need to learn to use Casbin first. Installation Usage Quick start Using Enforcer Api Using a middleware basic Enforcer Middleware HTTP Request Middleware ( RESTful is also supported ) Using Gates Multiple enforcers Using artisan commands Cache Thinks License Installation Require this package in the composer.json of your Laravel project. This will download the package. The Lauthz\\LauthzServiceProvider is auto-discovered and registered by default, but if you want to register it yourself: Add the ServiceProvider in config/app.php The Enforcer facade is also auto-discovered , but if you want to add it manually: Add the Facade in config/app.php To publish the config, run the vendor publish command: This will create a new model config file named config/lauthz-rbac-model.conf and a new lauthz config file named config/lauthz.php . To migrate the migrations, run the migrate command: This will create a new table named rules Usage Quick start Once installed you can do stuff like this: You can check if a user has a permission like this: By default, Gate checks will be automatically intercepted . You can check if a user has a permission with Laravel's default can function: Using Enforcer Api It provides a very rich api to facilitate various operations on the Policy: Gets all roles: Gets a","default_branch":null,"files":null,"tree":[],"storefront":"/r/php-casbin","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/php-casbin/laravel-authz/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}