https://github.com/evansims/openfga-php
Stop writing authorization logic. Start asking questions. OpenFGA high performance relationship-based access control for PHP.
https://github.com/evansims/openfga-php
abac authorization entitlements fga fine-grained-access-control fine-grained-authorization openfga pbac permissions php rbac rebac sdk security zanzibar
Last synced: 16 days ago
JSON representation
Stop writing authorization logic. Start asking questions. OpenFGA high performance relationship-based access control for PHP.
- Host: GitHub
- URL: https://github.com/evansims/openfga-php
- Owner: evansims
- License: apache-2.0
- Created: 2024-01-09T17:44:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-09T12:34:09.000Z (26 days ago)
- Last Synced: 2025-09-09T15:46:11.500Z (26 days ago)
- Topics: abac, authorization, entitlements, fga, fine-grained-access-control, fine-grained-authorization, openfga, pbac, permissions, php, rbac, rebac, sdk, security, zanzibar
- Language: PHP
- Homepage: https://openfga.dev
- Size: 4.34 MB
- Stars: 7
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
OpenFGA PHP SDK
Stop writing authorization logic. Start asking questions.
composer require evansims/openfga-php
**Every app needs permissions.** Most developers end up with authorization logic scattered across controllers, middleware, and business logic. Changes break things. New features require touching dozens of files.
**[OpenFGA](https://openfga.dev/) solves this.** Define your authorization rules once, query them anywhere. This SDK provides a modern PHP interface to [OpenFGA](https://openfga.dev/) and [Auth0 FGA](https://auth0.com/fine-grained-authorization).
## Installation
```bash
composer require evansims/openfga-php
```
## Quickstart
```php
use OpenFGA\Client;
use function OpenFGA\{allowed, tuple};$client = new Client(url: 'http://localhost:8080');
// Instead of scattered if statements in your controllers:
if ($user->isAdmin() || $user->owns($document) || $user->team->canEdit($document)) {
// ...
}// Ask OpenFGA:
$canEdit = allowed(
client: $client,
store: 'my-store',
model: 'my-model',
tuple: tuple('user:alice', 'editor', 'document:readme')
);// Zero business logic coupling. Pure authorization.
```See [the documentation](https://github.com/evansims/openfga-php/wiki) to get started.
## Contributing
Contributions are welcome—have a look at our [contributing guidelines](.github/CONTRIBUTING.md).