# 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,
],
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guardian.midnite.uk/getting-started/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
