Package

Intervention Httpauth

HTTP Authentication Management for PHP

Package

intervention/httpauth

View on GitHub →

Intervention HttpAuth

Intervention HttpAuth is a Laravel package that facilitates the management of HTTP authentication in PHP applications. It supports basic and digest authentication methods, providing a straightforward mechanism for securing web resources.

Key Features:

  • Multiple Authentication Methods: Supports basic and digest authentication.
  • Flexible Instance Creation: Offers several ways to create authentication instances, including static factory methods and class constructors.
  • Easy Integration: Simple to integrate with any PHP application using Composer.

Installation:

Install the package using Composer with the following command:

$ composer require intervention/httpauth

Usage:

Creating an Authentication Instance:

You can create an authentication instance using one of the following methods:

  1. Static Factory Method:

    use Intervention\HttpAuth\Authenticator;
    $auth = Authenticator::basic('Secured Realm');
    $auth->withUsername('admin');
    $auth->withPassword('secret');
    
  2. Static Universal Factory Method:

    $auth = Authenticator::make([
        'type' => 'basic',
        'realm' => 'Secure Resource',
        'username' => 'admin',
        'password' => 'secret',
    ]);
    
  3. Class Constructor:

    $auth = new Authenticator(
       'basic',
       'Secure Resource',
       'admin',
       'secret'
    );
    

Securing a Resource:

After creating an instance, secure your resource by invoking the secure() method, which triggers a 401 HTTP response and prompts the user for credentials.

$auth->secure();

Server Configuration:

For Apache users running PHP with FastCGI, specific configuration adjustments may be necessary to ensure proper handling of authorization headers. More details can be found in the provided support link in the package documentation.

Intervention HttpAuth offers a robust and flexible solution for managing HTTP authentication, ensuring your web resources are securely accessed with minimal setup.

Intervention Httpauth Related Articles

Intervention Validation image

Intervention Validation

Read article
Intervention Image image

Intervention Image

Read article
Stargazing in Your Laravel App with Intervention Zodiac image

Stargazing in Your Laravel App with Intervention Zodiac

Read article
Intervention Image v2 is released image

Intervention Image v2 is released

Read article
A Practical Guide to Laravel's First-Party Image Processing image

A Practical Guide to Laravel's First-Party Image Processing

Read article
First-Party Image Processing in Laravel 13.20 image

First-Party Image Processing in Laravel 13.20

Read article

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech

Let your users buy domains without leaving your app

If your Laravel app gives users a site, a storefront, or a workspace, they’ll eventually want their own domain. The name.com API lets them search, register, and connect one without leaving your product. It’s a clean REST API, so Laravel’s HTTP client is all you need.

Let your users buy domains without leaving your app

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift