vinkla/shield
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 advisedNot 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 |
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
Set the HSTS header to enable HTTP Strict Transport Security
A Guzzle middleware that logs requests to debugbar's timeline
A Laravel middleware for adding ETags to HTTP requests to improve response times
A lightweight package to add basic authentication to your Laravel app.
Safe request retries for Laravel APIs via the Idempotency-Key header.
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 | MIT | |
| 7.0.0 | ^7.4 | ^8.0 | MIT | |
| 6.0.0 | ^7.4 | ^7.0 | MIT | |
| 5.0.1 | ^7.4 | ^7.0 | MIT | |
| 5.0.0 | ^7.4 | ^7.0 | MIT | |
| 4.0.0 | ^7.4 | ^7.0 | MIT | |
| 3.0.0 | ^7.2 | ^6.0 | MIT | |
| 2.6.0 | ^7.1.3 | 5.8.* | MIT | |
| 2.5.0 | ^7.1.3 | 5.7.* | MIT | |
| 2.4.1 | ^7.1.3 | 5.6.* | MIT | |
| 2.4.0 | ^7.1.3 | 5.6.* | MIT | |
| 2.3.0 | ^7.0 | 5.5.* | MIT | |
| 2.2.0 | ^7.0 | 5.3.* || | MIT | |
| 2.1.1 | ^7.0 | 5.3.* || | MIT | |
| 2.1.0 | ^7.0 | 5.3.* || | MIT | |
| 2.0.0 | ^7.0 | 5.3.* | MIT | |
| 1.2.0 | ^5.6.4 || | 5.1.* || | MIT | |
| 1.1.0 | ^5.5.9 || | 5.1.* || | MIT | |
| 1.0.0 | ^5.5.9 || | 5.1.* || | MIT | |
| 0.3.2 | ^5.5.9 || | 5.1.* || | MIT | |
| 0.3.1 | ^5.5.9 || | 5.1.* || | MIT | |
| 0.3.0 | ^5.5.9 || | 5.1.* || | MIT | |
| 0.2.1 | ^5.5.9 || | 5.1.* || | MIT | |
| 0.2.0 | ^5.5.9 || | 5.1.* || | MIT | |
| 0.1.0 | ^5.5.9 || | 5.1.* || | MIT |