{"id":20876060,"url":"https://github.com/php-casbin/swoole-redis-watcher","last_synced_at":"2026-02-09T07:34:19.708Z","repository":{"id":62499944,"uuid":"430673120","full_name":"php-casbin/swoole-redis-watcher","owner":"php-casbin","description":"Redis watcher for PHP-Casbin in Swoole.","archived":false,"fork":false,"pushed_at":"2025-01-09T16:01:01.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-12T15:46:00.473Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-casbin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-22T11:07:35.000Z","updated_at":"2025-01-09T16:00:34.000Z","dependencies_parsed_at":"2025-01-09T17:21:13.467Z","dependency_job_id":"b0de2bde-ef62-4fe8-a8b8-92de6f19aebf","html_url":"https://github.com/php-casbin/swoole-redis-watcher","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/php-casbin/swoole-redis-watcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Fswoole-redis-watcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Fswoole-redis-watcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Fswoole-redis-watcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Fswoole-redis-watcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-casbin","download_url":"https://codeload.github.com/php-casbin/swoole-redis-watcher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Fswoole-redis-watcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29258759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T04:11:57.159Z","status":"ssl_error","status_checked_at":"2026-02-09T04:11:56.117Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T06:49:55.162Z","updated_at":"2026-02-09T07:34:19.691Z","avatar_url":"https://github.com/php-casbin.png","language":"PHP","readme":"# Redis watcher for PHP-Casbin in Swoole\n\n[![Latest Stable Version](https://poser.pugx.org/casbin/swoole-redis-watcher/v/stable)](https://packagist.org/packages/casbin/swoole-redis-watcher)\n[![Total Downloads](https://poser.pugx.org/casbin/swoole-redis-watcher/downloads)](https://packagist.org/packages/casbin/swoole-redis-watcher)\n[![License](https://poser.pugx.org/casbin/swoole-redis-watcher/license)](https://packagist.org/packages/casbin/swoole-redis-watcher)\n\nRedis 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.\n\n### Installation\n\nVia [Composer](https://getcomposer.org/).\n\n```\ncomposer require casbin/swoole-redis-watcher\n```\n\n### Usage\n\n```php\n\nrequire dirname(__FILE__) . '/../vendor/autoload.php';\n\nuse Casbin\\Enforcer;\nuse CasbinWatcher\\SwooleRedis\\Watcher;\n\nCo::set(['hook_flags'=\u003e SWOOLE_HOOK_ALL]); \n\n$http = new Swoole\\Http\\Server('0.0.0.0', 9501);\n\n$http-\u003eon('WorkerStart', function ($server, $worker_id) {\n    global $enforcer;\n\n    // Initialize the Watcher.\n    $watcher = new Watcher([\n        'host' =\u003e '127.0.0.1',\n        'password' =\u003e '',\n        'port' =\u003e 6379,\n        'database' =\u003e 0,\n    ]);\n\n    // Initialize the Enforcer.\n    $enforcer = new Enforcer(\"path/to/model.conf\", \"path/to/policy.csv\");\n\n    // Set the watcher for the enforcer.\n    $enforcer-\u003esetWatcher($watcher);\n\n    // By default, the watcher's callback is automatically set to the\n    // $enforcer-\u003eloadPolicy() in the setWatcher() call.\n    // We can change it by explicitly setting a callback.\n    $watcher-\u003esetUpdateCallback(function () use ($enforcer) {\n        // Now should reload all policies.\n        // $enforcer-\u003eloadPolicy();\n    });\n\n};\n\n$http-\u003eon('Request', function ($request, $response) {\n    // ...\n});\n\n$http-\u003estart();\n\n```\n\n### Getting Help\n\n- [php-casbin](https://github.com/php-casbin/php-casbin)\n\n### License\n\nThis project is licensed under the [Apache 2.0 license](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-casbin%2Fswoole-redis-watcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-casbin%2Fswoole-redis-watcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-casbin%2Fswoole-redis-watcher/lists"}