https://github.com/svenluijten/super-basic-auth
🔒 A lightweight package to add basic authentication to your Laravel app.
https://github.com/svenluijten/super-basic-auth
authentication basic-auth http-auth laravel laravel-authentication laravel-package
Last synced: 8 months ago
JSON representation
🔒 A lightweight package to add basic authentication to your Laravel app.
- Host: GitHub
- URL: https://github.com/svenluijten/super-basic-auth
- Owner: svenluijten
- License: mit
- Created: 2017-10-15T15:18:55.000Z (about 8 years ago)
- Default Branch: 2.x
- Last Pushed: 2025-03-05T09:39:47.000Z (9 months ago)
- Last Synced: 2025-03-22T00:44:14.454Z (9 months ago)
- Topics: authentication, basic-auth, http-auth, laravel, laravel-authentication, laravel-package
- Language: PHP
- Homepage: https://svenluijten.com
- Size: 93.8 KB
- Stars: 23
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README

# Super Basic Auth
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads][ico-downloads]][link-downloads]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-build]][link-build]
[![StyleCI][ico-styleci]][link-styleci]
This is a super lightweight package to add the most basic form of authentication
to your Laravel app. All you need is a webserver and a text editor!
## Installation
The installation instructions for this package can be found below.
### Downloading
Via [composer](http://getcomposer.org):
```bash
$ composer require sven/super-basic-auth
```
Or add the package to your dependencies in `composer.json` and run
`composer update` on the command line to download it:
```json
{
"require": {
"sven/super-basic-auth": "^2.3"
}
}
```
## Usage
To use this package, first add the following code to your `config/auth.php` file:
```php
return [
// ...
'basic' => [
'user' => env('AUTH_USERNAME'),
'password' => env('AUTH_PASSWORD'),
],
];
```
Be sure to add `AUTH_USERNAME` and `AUTH_PASSWORD` to your `.env` file. You can
call these entries whatever you want.
Finally, apply the middleware to any route you want protected by those credentials:
```php
Route::group('admin', function () {
// Your password protected routes.
})->middleware(\Sven\SuperBasicAuth\SuperBasicAuth::class);
```
## Contributing
All contributions (pull requests, issues and feature requests) are
welcome. Make sure to read through the [CONTRIBUTING.md](CONTRIBUTING.md) first,
though. See the [contributors page](../../graphs/contributors) for all contributors.
## License
`sven/super-basic-auth` is licensed under the MIT License (MIT). Please see the
[license file](LICENSE.md) for more information.
[ico-version]: https://img.shields.io/packagist/v/sven/super-basic-auth.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/sven/super-basic-auth.svg?style=flat-square
[ico-build]: https://img.shields.io/github/actions/workflow/status/svenluijten/super-basic-auth/run-tests.yml?style=flat-square
[ico-styleci]: https://styleci.io/repos/107023626/shield
[link-packagist]: https://packagist.org/packages/sven/super-basic-auth
[link-downloads]: https://packagist.org/packages/sven/super-basic-auth
[link-build]: https://github.com/svenluijten/super-basic-auth/actions/workflows/run-tests.yml
[link-styleci]: https://styleci.io/repos/107023626