{"id":20876083,"url":"https://github.com/php-casbin/cake-permission","last_synced_at":"2025-09-03T10:33:20.584Z","repository":{"id":46776534,"uuid":"157995018","full_name":"php-casbin/cake-permission","owner":"php-casbin","description":"Use Casbin in CakePHP Framework, Casbin is a powerful and efficient open-source access control library.","archived":false,"fork":false,"pushed_at":"2025-05-17T06:21:35.000Z","size":107,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-22T04:06:42.357Z","etag":null,"topics":["access-control","acl","cakephp","casbin","permissions","rbac","restful","roles"],"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}},"created_at":"2018-11-17T14:59:05.000Z","updated_at":"2025-05-17T06:21:38.000Z","dependencies_parsed_at":"2024-01-29T11:09:55.932Z","dependency_job_id":null,"html_url":"https://github.com/php-casbin/cake-permission","commit_stats":{"total_commits":18,"total_committers":3,"mean_commits":6.0,"dds":0.4444444444444444,"last_synced_commit":"6ec2bd6c166c18a0e86032e1d14ff650f0bc68ac"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/php-casbin/cake-permission","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Fcake-permission","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Fcake-permission/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Fcake-permission/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Fcake-permission/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-casbin","download_url":"https://codeload.github.com/php-casbin/cake-permission/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Fcake-permission/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273430542,"owners_count":25104481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["access-control","acl","cakephp","casbin","permissions","rbac","restful","roles"],"created_at":"2024-11-18T06:49:59.281Z","updated_at":"2025-09-03T10:33:20.558Z","avatar_url":"https://github.com/php-casbin.png","language":"PHP","readme":"# Cake-Permission\n\n[![Test](https://github.com/php-casbin/cake-permission/actions/workflows/test.yml/badge.svg)](https://github.com/php-casbin/cake-permission/actions/workflows/test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/php-casbin/cake-permission/badge.svg)](https://coveralls.io/github/php-casbin/cake-permission)\n[![Latest Stable Version](https://poser.pugx.org/casbin/cake-permission/v/stable)](https://packagist.org/packages/casbin/cake-permission)\n[![Total Downloads](https://poser.pugx.org/casbin/cake-permission/downloads)](https://packagist.org/packages/casbin/cake-permission)\n[![License](https://poser.pugx.org/casbin/cake-permission/license)](https://packagist.org/packages/casbin/cake-permission)\n\nUse Casbin in [CakePHP](https://github.com/cakephp/cakephp) Framework, Casbin is a powerful and efficient open-source access control library.\n\n### Installation\n\nRequire this package in the `composer.json` of your CakePHP project. This will download the package.\n\n```\ncomposer require casbin/cake-permission\n```\n\ncreate config file `config/casbin.php` for Casbin:\n\n```php\n\u003c?php\n\nreturn [\n    'Casbin' =\u003e [\n         /*\n         * Cake-casbin model setting.\n         */\n        'model' =\u003e [\n            // Available Settings: \"file\", \"text\"\n            'config_type' =\u003e 'file',\n            'config_file_path' =\u003e __DIR__.'/casbin-model.conf',\n            'config_text' =\u003e '',\n        ],\n\n        // Cake-casbin adapter .\n        'adapter' =\u003e '\\Cake\\Permission\\Adapter',\n\n        /*\n         * Cake-casbin database setting.\n         */\n        'database' =\u003e [\n            // Database connection for following tables.\n            'connection' =\u003e '',\n            // CasbinRule tables and model.\n            'casbin_rules_table' =\u003e '',\n        ],\n    ],\n];\n```\n\ncreate a new model config file named `config/casbin-model.conf`.\n\n```\n[request_definition]\nr = sub, obj, act\n\n[policy_definition]\np = sub, obj, act\n\n[policy_effect]\ne = some(where (p.eft == allow))\n\n[matchers]\nm = r.sub == p.sub \u0026\u0026 r.obj == p.obj \u0026\u0026 r.act == p.act\n```\n\n\n### Usage\n\n```php\n\n$sub = 'alice'; // the user that wants to access a resource.\n$obj = 'data1'; // the resource that is going to be accessed.\n$act = 'read'; // the operation that the user performs on the resource.\n\n$casbin = new \\Cake\\Permission\\Casbin();\n\nif (true === $casbin-\u003eenforce($sub, $obj, $act)) {\n    // permit alice to read data1\n} else {\n    // deny the request, show an error\n}\n```\n\n### Define your own model.conf\n\nYou can modify the config file named `config/casbin-model.conf`\n\n### Learning Casbin\n\nYou can find the full documentation of Casbin [on the website](https://casbin.org/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-casbin%2Fcake-permission","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-casbin%2Fcake-permission","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-casbin%2Fcake-permission/lists"}