PHPackages                             mstfkhazaal/defender - 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. mstfkhazaal/defender

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

mstfkhazaal/defender
====================

Roles &amp; Permissions for Laravel

V0.13.0(3y ago)18MITPHPPHP &gt;=7.2.0 || ^8.0

Since Mar 3Pushed 3y agoCompare

[ Source](https://github.com/mstfkhazaal/defender)[ Packagist](https://packagist.org/packages/mstfkhazaal/defender)[ RSS](/packages/mstfkhazaal-defender/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (7)Versions (51)Used By (0)

Defender
========

[](#defender)

---

Defender is an Access Control List (ACL) Solution for Laravel 5 / 6 / 7 / 8 / 9 (single auth). **(Not compatible with multi-auth)**
With security and usability in mind, this project aims to provide you a safe way to control your application access without losing the fun of coding.

> Current Build Status

[![Build Status](https://camo.githubusercontent.com/a482450c72f0e3fdf67b30a3cbd5a72d5f8574c08f333abe79747bcaf0117a1d/68747470733a2f2f7472617669732d63692e6f72672f6172746573616f732f646566656e6465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/artesaos/defender)[![Code Climate](https://camo.githubusercontent.com/b8b4919d485619e4214b7ebc45e5856b0e3fce4278f9631862948f19bca2a438/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6172746573616f732f646566656e6465722f6261646765732f6770612e737667)](https://codeclimate.com/github/artesaos/defender)[![StyleCI](https://camo.githubusercontent.com/b3137a8dd3d52325965f7e48bfb28bebcb6fccba3fd6145382c7ab0f4c25d9dd/68747470733a2f2f7374796c6563692e696f2f7265706f732f33313137393836322f736869656c64)](https://styleci.io/repos/31179862)

> Statistics

[![Latest Stable Version](https://camo.githubusercontent.com/a3ef672a9f724668b1760394f36f08bcc716594f46caf05e44feec84799e7e73/68747470733a2f2f706f7365722e707567782e6f72672f6172746573616f732f646566656e6465722f762f737461626c652e737667)](https://packagist.org/packages/artesaos/defender)[![Latest Unstable Version](https://camo.githubusercontent.com/5f4a8de287344d59b54d27c48092900022570a0095ee70f225863c26c6c57094/68747470733a2f2f706f7365722e707567782e6f72672f6172746573616f732f646566656e6465722f762f756e737461626c652e737667)](https://packagist.org/packages/artesaos/defender) [![License](https://camo.githubusercontent.com/a4182bbdcfc028ff746b9e72713d25be6dedb65c283fa17d0b52c544eb700887/68747470733a2f2f706f7365722e707567782e6f72672f6172746573616f732f646566656e6465722f6c6963656e73652e737667)](https://packagist.org/packages/artesaos/defender)[![Total Downloads](https://camo.githubusercontent.com/58f8f506398bd387e7fdfceed0c498659de88c4b42fc7ddf2c2d56c6b5ad7ee9/68747470733a2f2f706f7365722e707567782e6f72672f6172746573616f732f646566656e6465722f646f776e6c6f6164732e737667)](https://packagist.org/packages/artesaos/defender)[![Monthly Downloads](https://camo.githubusercontent.com/06cbc3969c60d1feefa42399e735c326c53d16a7de0c1ab3f6d435341595d300/68747470733a2f2f706f7365722e707567782e6f72672f6172746573616f732f646566656e6465722f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/artesaos/defender)[![Daily Downloads](https://camo.githubusercontent.com/6df1315fbaf3b5ccfaf25ecc8309a03622bb63a8f4e88a6bb5ff47ded8cad301/68747470733a2f2f706f7365722e707567782e6f72672f6172746573616f732f646566656e6465722f642f6461696c792e706e67)](https://packagist.org/packages/artesaos/defender)

Contribution welcome
--------------------

[](#contribution-welcome)

Defender is looking for maintainers and contributors.

Installation
------------

[](#installation)

### 1. Dependency

[](#1-dependency)

Using [composer](https://getcomposer.org/), execute the following command to automatically update your `composer.json`, using the corresponding package version:

Version ConstraintPackage Version&gt;= 5.0.\* &amp;&amp; &lt;= 5.3.\*0.6.\*~5.4, ~5.50.7.\*&gt;= 5.6.\*0.8.\*^6.00.9.\*^7.00.10.\*^8.00.11.\*^9.00.12.\*```
composer require artesaos/defender
```

or manually update your `composer.json` file

```
{
    "require": {
        "artesaos/defender": "~0.10.0"
    }
}
```

### 2. Provider

[](#2-provider)

> If you are using Laravel &gt;= 5.5 skip this section since our package support auto-discovery.

You need to update your application configuration in order to register the package, so it can be loaded by Laravel. Just update your `config/app.php` file adding the following code at the end of your `'providers'` section:

```
// file START ommited
    'providers' => [
        // other providers ommited
        \Artesaos\Defender\Providers\DefenderServiceProvider::class,
    ],
// file END ommited
```

### 3. User Class

[](#3-user-class)

On your User class, add the trait `Artesaos\Defender\Traits\HasDefender` to enable the creation of permissions and roles:

```
