Download the PHP package mvonline/openfga-laravel-rbac without Composer
On this page you can find all versions of the php package mvonline/openfga-laravel-rbac. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mvonline/openfga-laravel-rbac
More information about mvonline/openfga-laravel-rbac
Files in mvonline/openfga-laravel-rbac
Package openfga-laravel-rbac
Short Description PHP and Laravel SDK for using OpenFGA as an RBAC authorization operator.
License MIT
Homepage https://github.com/mvonline/openfga-laravel-rbac
Informations about the package openfga-laravel-rbac
OpenFGA Laravel RBAC
PHP and Laravel SDK for using OpenFGA as an RBAC and authorization service.
This package provides:
- A framework-agnostic PHP OpenFGA HTTP client
- Laravel auto-discovery, facades, config publishing, Gate integration, and middleware
- RBAC helper methods for roles, permissions, assignments, and common checks
- Advanced OpenFGA API support for contextual tuples, batch checks, list users, changes, assertions, stores, and authorization models
- Docker-friendly test workflow, so PHP does not need to be installed on the host machine
Requirements
- PHP
^8.1 - Composer
- OpenFGA server or OpenFGA-compatible endpoint
- Laravel
10,11, or12for Laravel-specific features
Installation
Laravel Setup
Publish the configuration file:
Configure your OpenFGA connection:
The package auto-registers these aliases in Laravel:
OpenFgafor the low-level OpenFGA clientOpenFgaRbacfor RBAC helper methods
OpenFGA Model Example
This model supports users, roles, a registry for listing roles and permissions, and a tenant resource.
For resource-specific permissions, add relations to your resource types. Example:
Laravel Usage
Low-Level Checks
RBAC Helpers
Role And Permission Queries
Any Or All Permission Checks
Laravel Middleware
Single check:
Any check can pass:
Every check must pass:
Route placeholders such as {invoice} are resolved from Laravel route parameters. If the parameter is an Eloquent model, the middleware uses getKey().
Plain PHP Usage
Advanced OpenFGA Client
Contextual Tuples And Conditions
Batch Checks
List Objects And Users
Tuple Writes
Models, Assertions, Changes, And Stores
Available Client Methods
Low-level OpenFGA client:
checkcheckRawbatchChecklistObjectslistObjectsRawlistUsersexpandreadTupleswriteTupledeleteTuplewritedeletewriteAdvancedwriteAuthorizationModelreadAuthorizationModelreadAuthorizationModelswriteAssertionsreadAssertionsreadChangescreateStorelistStoresgetStoredeleteStore
RBAC helper methods:
createRoledeleteRolecreatePermissiondeletePermissionlistRolesgetAllRoleslistPermissionsgetAllPermissionsassignRolerevokeRolehasRoleuserRolesrolesAssignedToUserusersAssignedToRolegrantRolePermissionrevokeRolePermissionrolePermissionscancanAnycanAll
Testing
Run tests in Docker:
Or use Composer:
Versioning
This package follows semantic versioning. Tag releases with Git tags:
Packagist will expose tagged versions as Composer releases.
License
MIT
All versions of openfga-laravel-rbac with dependencies
guzzlehttp/guzzle Version ^7.8
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.0