New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

vinkla/shield

A HTTP basic auth middleware for Laravel
408,588 226

Larablocks Analysis

vinkla/shield works with Laravel 10 (latest release 9.0.0, Feb 14, 2023), which reached end of life on Feb 4, 2025: no more fixes, even for security.

Laravel 5 to 9 in earlier releases.

Recommendation checks

Not advised

Not advised: marked abandoned on Packagist.

  • Marked abandoned on Packagist
  • Supports only Laravel 10, past end of life since Feb 4, 2025
  • No release in the last 12 months (last: Feb 14, 2023)
  • 8,914 downloads a month (needs 10,000)
  • 226 GitHub stars (at least 100)

State

Abandoned
  • Packagist marks this package abandoned.
  • Last stable release: Feb 14, 2023.
  • No releases in the last 12 months.
  • First released: Jan 27, 2016.
  • Monthly downloads: 8,914.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 3, 2026.

Install
composer require vinkla/shield
Latest Version:9.0.0
PHP:^8.1
Laravel:10
Older releases:5 – 9
License:MIT
Last Updated:Jan 14, 2024
Links: GitHub  ·  Packagist
Maintainer: vinkla

Laravel Shield

This package used to be an HTTP basic auth middleware for Laravel. However, it is now deprecated as I no longer use it personally. Laravel already has built-in basic auth support for their web guard.

If you need simpler basic auth for your API, instead of depending on a third-party library, you can add it yourself. Please follow the guide below.

To begin, update your .env file with the following details:

BASIC_AUTH_USER=your-username
BASIC_AUTH_PASSWORD=your-password

Modify your config/auth.php file as follows:

'basic' => [
    'user' => env('BASIC_AUTH_USER'),
    'password' => env('BASIC_AUTH_PASSWORD'),
],

Finally, create a middleware that resembles the code below:

<?php

declare(strict_types=1);

namespace App\Http\Middleware;

use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;

class BasicAuthMiddleware
{
    public function handle(Request $request, Closure $next): Response
    {
        $user = config('auth.basic.user');
        $password = config('auth.basic.password');

        if (
            $request->getUser() !== $user ||
            $request->getPassword() !== $password
        ) {
            throw new UnauthorizedHttpException('Basic');
        }

        return $next($request);
    }
}

That's it! You can now use the middleware in your routes.

use App\Http\Middleware\BasicAuthMiddleware;
use App\Models\User;

Route::get('api/users', function () {
    return User::all();
})->middleware(BasicAuthMiddleware::class);

Alternatives to vinkla/shield

zae/strict-transport-security

Set the HSTS header to enable HTTP Strict Transport Security

186,222 7
hannesvdvreken/guzzle-debugbar

A Guzzle middleware that logs requests to debugbar's timeline

453,141 76
matthewbdaly/laravel-etag-middleware

A Laravel middleware for adding ETags to HTTP requests to improve response times

340,954 64
sven/super-basic-auth

A lightweight package to add basic authentication to your Laravel app.

4,342 23
webrek/laravel-idempotency

Safe request retries for Laravel APIs via the Idempotency-Key header.

1,320 0

Version History

Version Released PHP Laravel License
9.0.0 ^8.1 ^10.0 MIT
8.0.0 ^8.0 ^9.0 MIT
7.1.0 ^7.4 || ^8.0 ^8.0 MIT
7.0.0 ^7.4 ^8.0 MIT
6.0.0 ^7.4 ^7.0 MIT