# php-casbin/php-casbin

An authorization library that supports access control models like ACL, RBAC, ABAC in PHP .

Repository: https://github.com/php-casbin/php-casbin
Canonical: https://ross.abutalabs.com/products/php-casbin
Homepage: https://casbin.org
Language: PHP
License: Apache-2.0
License Family: permissive
Topics: rbac, permission, php, access-control, authorization, acl, abac, middlewares, roles, framework, security, auth
Last push: 2026-08-12T03:09:39+00:00

## Health v2 (maintenance only)
Score: 98/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 97, release rhythm 97, longevity 100
- inputs: {"age_days": 2879, "days_push": 21, "days_rel": 21, "gap_med": 30.0, "n_releases_24m": 15}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1335, forks 135 (observed 2026-08-28T04:04:25.308011+00:00)

## What it is
PHP-Casbin is a powerful and efficient open-source access control library for PHP projects that enforces authorization based on models like ACL, RBAC, and ABAC. It is the PHP implementation of the cross-language Casbin ecosystem, with policies loadable from files or databases via adapters.

## Use cases
- add role-based access control (RBAC) to a PHP application
- enforce ACL permissions on API endpoints
- implement attribute-based access control (ABAC) in PHP
- store authorization policies in MySQL or PostgreSQL
- manage role hierarchies and permissions in Laravel or other PHP frameworks
- switch authorization models by editing a config file instead of code

## When to choose
- you need flexible, model-driven authorization in a PHP project
- you want support for multiple access control models (ACL, RBAC, ABAC) in one library
- you need policy persistence across many storage backends via adapters
- you want API consistency with other Casbin language implementations

## When to avoid
- you only need simple hardcoded role checks with no policy management
- your project is not in PHP
- you need authentication (login/identity) rather than authorization - Casbin does not handle that

## Facets
- artifact type: library
- maturity: active
- function: authorization, auth, middleware
- domain: security, web-development, backend, developer-tools
- platform: php
- tags: rbac, acl, abac, access-control, permissions, casbin, policy-enforcement

## Member repositories
- php-casbin/php-casbin (main) score 98

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:25.308011+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:44:23.256378+00:00, confidence not recorded.
  - readme: https://github.com/php-casbin/php-casbin (fetched 2026-08-28T04:04:25.308011+00:00, sha 057523a2081e)
  - homepage: https://casbin.org (fetched 2026-08-29T12:03:47.896944+00:00, sha bf9a21b944e9)
  - site_page: https://casbin.apache.org/docs/overview (fetched 2026-08-29T12:03:47.905958+00:00, sha e6df9330fc66)
  - site_page: https://casbin.apache.org/docs/downloads (fetched 2026-08-29T12:03:47.907955+00:00, sha 34577d2c2ff2)
  - site_page: https://casbin.apache.org/docs/get-started (fetched 2026-08-29T12:03:47.909932+00:00, sha 1cef184398ca)
  - site_page: https://casbin.apache.org/docs/category/access-control-models (fetched 2026-08-29T12:03:47.912034+00:00, sha 323b2c9c0a23)
  - site_page: https://casbin.apache.org/docs/category/storage (fetched 2026-08-29T12:03:47.913670+00:00, sha 36570671a14a)
  - site_page: https://casbin.apache.org/docs/adapters (fetched 2026-08-29T12:03:47.915312+00:00, sha cd140120068d)
  - site_page: https://casbin.apache.org/docs/category/api (fetched 2026-08-29T12:03:47.917531+00:00, sha 4099ba1bb75f)
  - site_page: https://casbin.apache.org/docs/ide-plugins (fetched 2026-08-29T12:03:47.919266+00:00, sha 5a9e92f4f45a)
- Data as of 2026-08-30T08:39:29.467469+00:00.
