PHPackages                             statix/sentra - 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. statix/sentra

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

statix/sentra
=============

A lightweight Laravel roles and permissions package using Backed Enums.

0.1.0(1y ago)03MITPHPPHP ^8.3

Since Dec 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/statix-php/sentra)[ Packagist](https://packagist.org/packages/statix/sentra)[ Docs](https://github.com/statix-php/sentra)[ GitHub Sponsors](https://github.com/Statix)[ RSS](/packages/statix-sentra/feed)WikiDiscussions main Synced 1mo ago

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

Sentra for Laravel
==================

[](#sentra-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/044d31b877829c614c435efbbef5db1e1af78d84c83f96afad2afeb447070478/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374617469782f73656e7472612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/statix/sentra)

A lightweight Laravel roles and permissions package using Backed Enums.

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

[](#installation)

You can install the package via composer:

```
composer require statix/sentra
```

You should publish the config file with the following command:

```
php artisan vendor:publish --tag="sentra"
```

This is the contents of the published config file:

```
return [

    /**
     * The backed enum class that will be used to define your roles.
     */
    'roles_enum' => 'App\Enums\Roles',

    /**
     * The backed enum class that will be used to define your permissions.
     */
    'permissions_enum' => 'App\Enums\Permissions',

];
```

Usage
-----

[](#usage)

To get started, create two string backed Enums - one of your roles and one for your permissions.

```
php artisan make:enum "App\Enums\Roles" --string
php artisan make:enum "App\Enums\Permissions" --string
```

If you create your enums in a different namespace or different name, be sure to update the `roles_enum` and `permissions_enum` in the `sentra.php` config file.

Then add the `AsRole` trait to your `Roles` enum.

```
