PHPackages                             casbin/swoole-redis-watcher - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. casbin/swoole-redis-watcher

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

casbin/swoole-redis-watcher
===========================

Redis watcher for PHP-Casbin in swoole.

v2.0.0(1y ago)1141Apache-2.0PHPPHP &gt;=8.0

Since Nov 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/php-casbin/swoole-redis-watcher)[ Packagist](https://packagist.org/packages/casbin/swoole-redis-watcher)[ RSS](/packages/casbin-swoole-redis-watcher/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Redis watcher for PHP-Casbin in Swoole
======================================

[](#redis-watcher-for-php-casbin-in-swoole)

[![Latest Stable Version](https://camo.githubusercontent.com/5d659261e4a9b1ab5050062e68efbd26ce7979d29327b83953de311c002af29e/68747470733a2f2f706f7365722e707567782e6f72672f63617362696e2f73776f6f6c652d72656469732d776174636865722f762f737461626c65)](https://packagist.org/packages/casbin/swoole-redis-watcher)[![Total Downloads](https://camo.githubusercontent.com/ae9741a613bbe59a87033c03b2714a931a80062457369f0fc6e8d30a1af44a07/68747470733a2f2f706f7365722e707567782e6f72672f63617362696e2f73776f6f6c652d72656469732d776174636865722f646f776e6c6f616473)](https://packagist.org/packages/casbin/swoole-redis-watcher)[![License](https://camo.githubusercontent.com/8819d978ad4f89eec2acb5656e8f76f5612fa5411af85a4662dde36369f89d76/68747470733a2f2f706f7365722e707567782e6f72672f63617362696e2f73776f6f6c652d72656469732d776174636865722f6c6963656e7365)](https://packagist.org/packages/casbin/swoole-redis-watcher)

Redis watcher for [PHP-Casbin](https://github.com/php-casbin/php-casbin) in [Swoole](https://www.swoole.com/) , [Casbin](https://casbin.org/) is a powerful and efficient open-source access control library.

### Installation

[](#installation)

Via [Composer](https://getcomposer.org/).

```
composer require casbin/swoole-redis-watcher

```

### Usage

[](#usage)

```
require dirname(__FILE__) . '/../vendor/autoload.php';

use Casbin\Enforcer;
use CasbinWatcher\SwooleRedis\Watcher;

Co::set(['hook_flags'=> SWOOLE_HOOK_ALL]);

$http = new Swoole\Http\Server('0.0.0.0', 9501);

$http->on('WorkerStart', function ($server, $worker_id) {
    global $enforcer;

    // Initialize the Watcher.
    $watcher = new Watcher([
        'host' => '127.0.0.1',
        'password' => '',
        'port' => 6379,
        'database' => 0,
    ]);

    // Initialize the Enforcer.
    $enforcer = new Enforcer("path/to/model.conf", "path/to/policy.csv");

    // Set the watcher for the enforcer.
    $enforcer->setWatcher($watcher);

    // By default, the watcher's callback is automatically set to the
    // $enforcer->loadPolicy() in the setWatcher() call.
    // We can change it by explicitly setting a callback.
    $watcher->setUpdateCallback(function () use ($enforcer) {
        // Now should reload all policies.
        // $enforcer->loadPolicy();
    });

};

$http->on('Request', function ($request, $response) {
    // ...
});

$http->start();
```

### Getting Help

[](#getting-help)

- [php-casbin](https://github.com/php-casbin/php-casbin)

### License

[](#license)

This project is licensed under the [Apache 2.0 license](LICENSE).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance41

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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 ~1144 days

Total

2

Last Release

487d ago

Major Versions

v1.0.0 → v2.0.02025-01-09

### 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 (5 commits)")[![Dobmod](https://avatars.githubusercontent.com/u/33273950?v=4)](https://github.com/Dobmod "Dobmod (1 commits)")

---

Tags

aclpermissionrbacswoolewatchercasbin

### Embed Badge

![Health badge](/badges/casbin-swoole-redis-watcher/health.svg)

```
[![Health](https://phpackages.com/badges/casbin-swoole-redis-watcher/health.svg)](https://phpackages.com/packages/casbin-swoole-redis-watcher)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k89.8M1.0k](/packages/spatie-laravel-permission)[casbin/casbin

a powerful and efficient open-source access control library for php projects.

1.3k1.4M54](/packages/casbin-casbin)[casbin/laravel-authz

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

324339.9k4](/packages/casbin-laravel-authz)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[casbin/think-authz

An authorization library that supports access control models like ACL, RBAC, ABAC for ThinkPHP.

27918.5k6](/packages/casbin-think-authz)[casbin/webman-permission

webman casbin permission plugin

523.4k2](/packages/casbin-webman-permission)

PHPackages © 2026

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