PHPackages                             casbin/laravel-adapter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. casbin/laravel-adapter

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

casbin/laravel-adapter
======================

Use casbin in laravel.

v0.2(7y ago)415756[1 issues](https://github.com/php-casbin/laravel-casbin/issues)Apache-2.0PHP

Since Oct 29Pushed 7y ago2 watchersCompare

[ Source](https://github.com/php-casbin/laravel-casbin)[ Packagist](https://packagist.org/packages/casbin/laravel-adapter)[ RSS](/packages/casbin-laravel-adapter/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (6)Versions (5)Used By (0)

Laravel-Casbin
==============

[](#laravel-casbin)

[![Build Status](https://camo.githubusercontent.com/62fc7f2fbcc046486c711eb9ad9e3c52ba208c01098544d186abdd25dd896a7e/68747470733a2f2f7472617669732d63692e6f72672f7068702d63617362696e2f6c61726176656c2d63617362696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/php-casbin/laravel-casbin)[![Coverage Status](https://camo.githubusercontent.com/0fc2ac6a603ff1a018db0f9af9f50053d5416fdc64d42ca5c7491c0041e30eca/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7068702d63617362696e2f6c61726176656c2d63617362696e2f62616467652e737667)](https://coveralls.io/github/php-casbin/laravel-casbin)[![Latest Stable Version](https://camo.githubusercontent.com/bc6cd3bb3eea42addab51430751f290df2415bc2b446994b77973958e38dab77/68747470733a2f2f706f7365722e707567782e6f72672f63617362696e2f6c61726176656c2d616461707465722f762f737461626c65)](https://packagist.org/packages/casbin/laravel-adapter)[![Total Downloads](https://camo.githubusercontent.com/ada9a361ae633c85d2714094fe958dcdbd428b50ee0add9c36b7aea13b2cc61c/68747470733a2f2f706f7365722e707567782e6f72672f63617362696e2f6c61726176656c2d616461707465722f646f776e6c6f616473)](https://packagist.org/packages/casbin/laravel-adapter)[![License](https://camo.githubusercontent.com/40bbc4049d34f5b38db5e9164c7f3481e6a7bfb11802d21fe5e5e2248c25c792/68747470733a2f2f706f7365722e707567782e6f72672f63617362696e2f6c61726176656c2d616461707465722f6c6963656e7365)](https://packagist.org/packages/casbin/laravel-adapter)

Use [Casbin](https://github.com/php-casbin/php-casbin) in Laravel.

#### It is worth mentioning that we now recommend [`laravel-authz`](https://github.com/php-casbin/laravel-authz).

[](#it-is-worth-mentioning-that-we-now-recommend-laravel-authz)

### Installation

[](#installation)

Require this package in the `composer.json` of your Laravel project. This will download the package.

```
composer require casbin/laravel-adapter

```

The `CasbinAdapter\Laravel\CasbinServiceProvider` is `auto-discovered` and registered by default, but if you want to register it yourself:

Add the ServiceProvider in `config/app.php`

```
'providers' => [
    /*
     * Package Service Providers...
     */
    CasbinAdapter\Laravel\CasbinServiceProvider::class,
]
```

The Casbin facade is also `auto-discovered`, but if you want to add it manually:

Add the Facade in `config/app.php`

```
'aliases' => [
    // ...
    'Casbin' => CasbinAdapter\Laravel\Facades\Casbin::class,
]
```

To publish the config, run the vendor publish command:

```
php artisan vendor:publish

```

This will create a new model config file named `config/casbin-basic-model.conf` and a new casbin config file named `config/casbin.php`.

To migrate the migrations, run the migrate command:

```
php artisan migrate

```

This will create a new table named `casbin_rule`

### Usage

[](#usage)

```
use \Casbin;

$sub = "alice"; // the user that wants to access a resource.
$obj = "data1"; // the resource that is going to be accessed.
$act = "read"; // the operation that the user performs on the resource.

if (Casbin::enforce($sub, $obj, $act) === true) {
    // permit alice to read data1
} else {
    // deny the request, show an error
}
```

### Define your own model.conf

[](#define-your-own-modelconf)

You can modify the config file named `config/casbin-basic-model.conf`

### Learning Casbin

[](#learning-casbin)

You can find the full documentation of Casbin [on the website](https://casbin.org/).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~51 days

Total

4

Last Release

2597d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f32cb7625515c0969fec15915be4a137f057c3484420bb7abf025c8e975dd3a5?d=identicon)[leeqvip](/maintainers/leeqvip)

---

Top Contributors

[![leeqvip](https://avatars.githubusercontent.com/u/35752209?v=4)](https://github.com/leeqvip "leeqvip (12 commits)")

---

Tags

acladaptercasbinlaravelpermissionrbaclaraveldatabasecasbincasbin-adapter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/casbin-laravel-adapter/health.svg)

```
[![Health](https://phpackages.com/badges/casbin-laravel-adapter/health.svg)](https://phpackages.com/packages/casbin-laravel-adapter)
```

###  Alternatives

[casbin/database-adapter

Database adapter for php-casbin.

30106.8k2](/packages/casbin-database-adapter)[casbin/yii-permission

Use Casbin in Yii2 PHP Framework, Casbin is a powerful and efficient open-source access control library.

468.0k](/packages/casbin-yii-permission)[waad/laravel-model-metadata

A robust Laravel package for handling metadata with JSON casting, custom relation names, and advanced querying capabilities.

823.1k](/packages/waad-laravel-model-metadata)[nevadskiy/laravel-geonames

Populate your database using the GeoNames service.

2715.1k](/packages/nevadskiy-laravel-geonames)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
