focela/laratrust

PHP 8.0+ fully-featured authentication & authorization system

v10.0.1 2024-07-08 15:56 UTC

README

Build Status Total Downloads Latest Version on Packagist Software License

Laratrust is a PHP 8.1+ framework agnostic fully-featured authentication and authorization system. It also provides additional features such as user roles and additional security features.

Laratrust's key features are:

  • Authentication.
  • Authorization.
  • Registration.
  • Users & Roles Management.
  • Driver based permission system.
  • Flexible activation scenarios.
  • Reminders (password reset).
  • Inter-account throttling with DDoS protection.
  • Custom hashing strategies.
  • Multiple sessions.
  • Multiple login columns.
  • Integration with Laravel.
  • Allow use of multiple ORM implementations.
  • Native facade for easy usage outside Laravel.
  • Interface driven (your own implementations at will).

Installation

composer require focela/laratrust

Quick Start

Laratrust packages are framework agnostic and as such can be integrated easily natively or with your favorite framework.

The Laratrust package has optional support for Laravel 10, and it comes bundled with a Service Provider and a Facade for easy integration.

After installing the package, open your Laravel config file located at config/app.php and add the following lines.

In the $providers array add the following service provider for this package.

Focela\Laratrust\Laravel\LaratrustServiceProvider::class,

In the $aliases array add the following facades for this package.

'Activation' => Focela\Laratrust\Laravel\Facades\Activation::class,
'Reminder'   => Focela\Laratrust\Laravel\Facades\Reminder::class,
'Laratrust'  => Focela\Laratrust\Laravel\Facades\Laratrust::class,

Assets

Run the following command to publish the migrations and config file.

php artisan vendor:publish --provider="Focela\Laratrust\Laravel\LaratrustServiceProvider"

Migrations

Run the following command to migrate Laratrust after publishing the assets.

Note: Before running the following command, please remove the default Laravel migrations to avoid table collision.

php artisan migrate

Configuration

After publishing, the laratrust config file can be found under config/focela.laratrust.php where you can modify the package configuration.

Contributing

We encourage and support an active, healthy community of contributors — including you! Details are in the contribution guide and the code of conduct. The laratrust maintainers keep an eye on issues and pull requests, but you can also report any negative conduct to opensource@focela.com. That email list is a private, safe space; even the laratrust maintainers don't have access, so don't hesitate to hold us to a high standard.

Released under the MIT License.