{"id":13828340,"url":"https://github.com/php-casbin/laravel-casbin","last_synced_at":"2025-07-09T06:31:39.495Z","repository":{"id":56951779,"uuid":"153653329","full_name":"php-casbin/laravel-casbin","owner":"php-casbin","description":"This repository has moved to https://github.com/php-casbin/laravel-authz","archived":true,"fork":false,"pushed_at":"2019-04-02T09:49:39.000Z","size":24,"stargazers_count":43,"open_issues_count":1,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-03-25T11:40:29.704Z","etag":null,"topics":["acl","adapter","casbin","laravel","permission","rbac"],"latest_commit_sha":null,"homepage":"","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}},"created_at":"2018-10-18T16:19:33.000Z","updated_at":"2024-03-01T02:14:32.000Z","dependencies_parsed_at":"2022-08-21T09:20:14.532Z","dependency_job_id":null,"html_url":"https://github.com/php-casbin/laravel-casbin","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Flaravel-casbin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Flaravel-casbin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Flaravel-casbin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-casbin%2Flaravel-casbin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-casbin","download_url":"https://codeload.github.com/php-casbin/laravel-casbin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225492420,"owners_count":17482869,"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","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":["acl","adapter","casbin","laravel","permission","rbac"],"created_at":"2024-08-04T09:02:42.134Z","updated_at":"2024-11-20T08:30:25.961Z","avatar_url":"https://github.com/php-casbin.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Laravel-Casbin\n\n[![Build Status](https://travis-ci.org/php-casbin/laravel-casbin.svg?branch=master)](https://travis-ci.org/php-casbin/laravel-casbin)\n[![Coverage Status](https://coveralls.io/repos/github/php-casbin/laravel-casbin/badge.svg)](https://coveralls.io/github/php-casbin/laravel-casbin)\n[![Latest Stable Version](https://poser.pugx.org/casbin/laravel-adapter/v/stable)](https://packagist.org/packages/casbin/laravel-adapter)\n[![Total Downloads](https://poser.pugx.org/casbin/laravel-adapter/downloads)](https://packagist.org/packages/casbin/laravel-adapter)\n[![License](https://poser.pugx.org/casbin/laravel-adapter/license)](https://packagist.org/packages/casbin/laravel-adapter)\n\nUse [Casbin](https://github.com/php-casbin/php-casbin) in Laravel.\n\n#### It is worth mentioning that we now recommend [`laravel-authz`](https://github.com/php-casbin/laravel-authz).\n\n### Installation\n\nRequire this package in the `composer.json` of your Laravel project. This will download the package.\n\n```\ncomposer require casbin/laravel-adapter\n```\n\nThe `CasbinAdapter\\Laravel\\CasbinServiceProvider` is `auto-discovered` and registered by default, but if you want to register it yourself:\n\nAdd the ServiceProvider in `config/app.php`\n\n```php\n'providers' =\u003e [\n    /*\n     * Package Service Providers...\n     */\n    CasbinAdapter\\Laravel\\CasbinServiceProvider::class,\n]\n```\n\nThe Casbin facade is also `auto-discovered`, but if you want to add it manually:\n\nAdd the Facade in `config/app.php`\n\n```php\n'aliases' =\u003e [\n    // ...\n    'Casbin' =\u003e CasbinAdapter\\Laravel\\Facades\\Casbin::class,\n]\n```\n\nTo publish the config, run the vendor publish command:\n\n```\nphp artisan vendor:publish\n```\n\nThis will create a new model config file named `config/casbin-basic-model.conf` and a new casbin config file named `config/casbin.php`.\n\n\nTo migrate the migrations, run the migrate command:\n\n```\nphp artisan migrate\n```\n\nThis will create a new table named `casbin_rule`\n\n\n### Usage\n\n```php\n\nuse \\Casbin;\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\nif (Casbin::enforce($sub, $obj, $act) === true) {\n    // permit alice to read data1\n} else {\n    // deny the request, show an error\n}\n\n```\n\n### Define your own model.conf\n\nYou can modify the config file named `config/casbin-basic-model.conf`\n\n### Learning Casbin\n\nYou can find the full documentation of Casbin [on the website](https://casbin.org/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-casbin%2Flaravel-casbin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-casbin%2Flaravel-casbin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-casbin%2Flaravel-casbin/lists"}