HTTP authentication (Basic & Digest) including ServiceProviders for easy Laravel integration

3.0.3 2021-01-22 15:08 UTC

This package is auto-updated.

Last update: 2021-11-22 17:03:45 UTC


Library to manage HTTP authentication with PHP. Includes ServiceProviders for easy Laravel integration.

Latest Version build Monthly Downloads


You can install this package quick and easy with Composer.

Require the package via Composer:

$ composer require intervention/httpauth

Laravel integration (optional)

The HttpAuth library is built to work with the Laravel Framework (>=5.5). It comes with a service provider and facades, which will be discovered automatically after installation.


To create HTTP authentication instances you can choose between different methods.

Static instantiation by array

use Intervention\HttpAuth\HttpAuth;

// create basic auth by array
$auth = HttpAuth::make([
    'type' => 'basic',
    'realm' => 'Secure Resource',
    'username' => 'admin',
    'password' => 'secret',

Instantiation by calls

use Intervention\HttpAuth\HttpAuth;

// create digest auth
$auth = HttpAuth::make();

Ask user for credentials

After you created a HTTP authentication instance, you have to call secure() to ask for credentials.


Server Configuration


If you are using Apache and running php with fast-cgi, check setting headers:


Intervention HttpAuth Class is licensed under the MIT License.