Installation

This PHP package is for PHP 8.2 and greater

Requirements

  • PHP 8.2 or higher

  • Composer

Basic Installation

You can install Guardian via Composer by running the following command in your project directory:

composer require midnite81/guardian

Framework Integration

While Guardian is framework-agnostic, it comes with built-in support for Laravel.

Laravel Integration

For Laravel projects, Guardian provides a Service Provider and a Facade, which are automatically registered in most cases.

Automatic Registration (Laravel 5.5+)

If you're using Laravel 5.5 or higher with package auto-discovery enabled, you don't need to manually register the service provider or facade.

Manual Registration

If you've disabled auto-discovery or are using an older version of Laravel, you'll need to manually register the service provider and facade.

For Laravel 11+:

Add the following to your bootstrap/app.php:

For Laravel 10 and below:

Add the following to your config/app.php:

Last updated