# Installation

{% hint style="info" %}
This PHP package is for PHP 8.2 and greater
{% endhint %}

## Requirements

* PHP 8.2 or higher
* Composer

## Basic Installation

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

```bash
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`:

```php
->withProviders([
    \Midnite81\Guardian\Providers\GuardianServiceProvider::class,
])
```

**For Laravel 10 and below:**

Add the following to your `config/app.php`:

```php
'providers' => [
    // Other service providers...
    \Midnite81\Guardian\Providers\GuardianServiceProvider::class,
],

'aliases' => [
    // Other facades...
    'Guardian' => \Midnite81\Guardian\Facades\Guardian::class,
],
```
