---
application: "Intervention HttpAuth"
version: "Version 4"
status: "eol"
---

# Intervention HttpAuth

## HTTP Authentication Management



Intervention HttpAuth is a library to manage HTTP basic & digest authentication.

### Code Example

The handling is easy. You just have to create an authenticator with your desired settings and call the `secure()` method to check for given credentials

```php
use Intervention\HttpAuth\Authenticator;

// create authenticator
$auth = new Authenticator();
$auth->withType('digest');
$auth->withRealm('Secure Realm');
$auth->withCredentials('admin', 'secret');

// check for credentials
$auth->secure();
```

The library comes with several static factory methods to create the authenticator.

```php
use Intervention\HttpAuth\Authenticator;

// create by array
$auth = Authenticator::make([
   'type' => 'basic',
   'realm' => 'Secure Resource',
   'username' => 'admin',
   'password' => 'secret',
]);
```

Read more on how to [install](https://httpauth.intervention.io/v4/getting-started/installation.md) or [use the package](https://httpauth.intervention.io/v4/api/authenticator.md)

---

## Become a Sponsor

### Intervention HttpAuth needs your help to keep the project going

Intervention HttpAuth is non-commercial, open source licensed and completely free to use. The considerable
effort required to maintain and develop the software is only possible with the financial support
of sponsors. There are two ways in which you can support this project.

- Support via [GitHub Sponsors](https://github.com/sponsors/Intervention)
- Support via [Ko-Fi](https://ko-fi.com/interventionphp)