Skip to content

Commit 393f9dc

Browse files
committed
Update README.md
1 parent a3a30ff commit 393f9dc

File tree

1 file changed

+65
-34
lines changed

1 file changed

+65
-34
lines changed

README.md

Lines changed: 65 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/codezero-be/laravel-stagefront/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/codezero-be/laravel-stagefront/?branch=master)
88
[![Total Downloads](https://img.shields.io/packagist/dt/codezero/laravel-stagefront.svg)](https://packagist.org/packages/codezero/laravel-stagefront)
99

10-
#### Quickly add some password protection to a staging site.
10+
#### Quickly add password protection to a staging site.
1111

1212
Shielding a staging or demo website from the public usually involves setting op authentication separate from the actual project. This isn't always easy or is cumbersome at the least.
1313

@@ -17,31 +17,49 @@ By installing StageFront with composer, adding the middleware and setting 3 vari
1717

1818
![Login Screen](screenshots/screenshot-login.png)
1919

20-
## Requirements
20+
## Requirements
2121

22-
- PHP >= 7.0
23-
- [Laravel](https://laravel.com/) >= 5.5
22+
- PHP >= 7.1
23+
- [Laravel](https://laravel.com/) >= 5.6
2424

25-
## Installation
25+
## 📦 Installation
2626

27-
Require the package via Composer:
27+
#### ☑️ Require the package via Composer:
2828

29-
```
29+
```bash
3030
composer require codezero/laravel-stagefront
3131
```
32-
Add the middleware to the web middleware group, **right after the `StartSession` middleware** in `app/Http/Kernel.php`:
32+
Laravel will automatically register the [ServiceProvider](https://github.com/codezero-be/laravel-stagefront/blob/master/src/StageFrontServiceProvider.php) and routes.
33+
34+
When StageFront is disabled, its routes will not be registered.
35+
36+
#### ☑️ Install Middleware
37+
38+
To activate the middleware, add it to the `web` middleware group in `app/Http/Kernel.php`, **right after the `StartSession` middleware**:
3339

3440
```php
35-
\CodeZero\StageFront\Middleware\RedirectIfStageFrontIsEnabled::class,
41+
protected $middlewareGroups = [
42+
'web' => [
43+
\Illuminate\Session\Middleware\StartSession::class, // <= after this
44+
\CodeZero\StageFront\Middleware\RedirectIfStageFrontIsEnabled::class,
45+
//...
46+
],
47+
];
3648
```
3749

38-
Laravel will automatically register the [ServiceProvider](https://github.com/codezero-be/laravel-stagefront/blob/master/src/StageFrontServiceProvider.php) and routes.
50+
In Laravel 6+ you need to add the middleware to the `$middlewarePriority` array in `app/Http/Kernel.php`, **right after the `StartSession` middleware**.
3951

40-
When StageFront is disabled, its routes will not be registered.
52+
```php
53+
protected $middlewarePriority = [
54+
\Illuminate\Session\Middleware\StartSession::class, // <= after this
55+
\CodeZero\StageFront\Middleware\RedirectIfStageFrontIsEnabled::class,
56+
//...
57+
];
58+
```
4159

4260
Now you just need to set some `.env` variables and you are up and running!
4361

44-
## Quick Setup
62+
## ⌨️ Quick Setup
4563

4664
Set some options in your `.env` file or publish the [configuration file](#publish-configuration-file).
4765

@@ -62,7 +80,7 @@ If you set `STAGEFRONT_ENCRYPTED` to `true` the password should be a hashed valu
6280

6381
You can generate this using Laravel's `\Hash::make('your password')` function.
6482

65-
## Database Logins
83+
## 👥 Database Logins
6684

6785
If you have existing users in the database and want to use those credentials, you can set `STAGEFRONT_DATABASE` to `true`. The above settings will then be ignored.
6886

@@ -78,7 +96,9 @@ If you want to grant access to just a few of those users, you can whitelist them
7896

7997
By default the `users` table is used with the `email` and `password` field names. But you can change this if you are using some other table or fields.
8098

81-
## Change Route URL
99+
## ⚙️ Other Options
100+
101+
#### ☑️ Change Route URL
82102

83103
By default a `GET` and `POST` route will be registered with the `/stagefront` URL.
84104

@@ -92,7 +112,7 @@ It runs under the `web` middleware since it uses the session to keep you logged
92112

93113
You can change the middleware if needed in the [configuration file](#publish-configuration-file).
94114

95-
## Throttle Login Attempts
115+
#### ☑️ Throttle Login Attempts
96116

97117
To prevent malicious users from brute forcing passwords, login attempts will be throttled unless you disable it. You can change the number of failed attempts per minute to allow, and the delay (in minutes) that users have to wait after reaching the maximum failed attempts.
98118

@@ -122,7 +142,7 @@ Text in this view can be changed via the [translation files](#translations-and-v
122142

123143
![Throttle Screen](screenshots/screenshot-throttled.png)
124144

125-
## Ignore URLs
145+
#### ☑️ Ignore URLs
126146

127147
If for any reason you wish to disable StageFront on specific routes, you can add these to the `ignore_urls` array in the [configuration file](#publish-configuration-file). You can use wildcards if needed. You can't set this in the `.env` file.
128148

@@ -137,7 +157,7 @@ For example:
137157
],
138158
```
139159

140-
## Link Live Site
160+
#### ☑️ Link Live Site
141161

142162
If you set the URL to your live site, a link will be shown underneath the login form.
143163

@@ -147,52 +167,63 @@ If you set the URL to your live site, a link will be shown underneath the login
147167

148168
Make sure you enter the full URL, including `https://`.
149169

150-
## Change App Name
170+
#### ☑️ Change App Name
151171

152172
By default, the app name that is configured in `config/app.php` is shown as a title on the login and throttle page. You can use a different title by setting this option:
153173

154174
| Option | Type | Default |
155175
| --------------------- | -------- | -------------------- |
156176
| `STAGEFRONT_APP_NAME` | `string` | `config('app.name')` |
157177

158-
## Publish Configuration File
178+
## 📇 Publish Configuration File
159179

160180
You can also publish the configuration file.
161181

162-
```
163-
php artisan vendor:publish
182+
```bash
183+
php artisan vendor:publish --provider="CodeZero\StageFront\StageFrontServiceProvider" --tag="config"
164184
```
165185

166186
Each option is documented.
167187

168-
## Translations and Views
188+
## 📑 Translations and Views
169189

170-
You can publish the translations to quickly adjust the text on the login screen and the errors. If you want to customize the login page entirely, you can also publish the view.
190+
You can publish the translations to quickly adjust the text on the login screen and the errors.
171191

192+
```bash
193+
php artisan vendor:publish --provider="CodeZero\StageFront\StageFrontServiceProvider" --tag="lang"
172194
```
173-
php artisan vendor:publish
195+
196+
If you want to customize the login page entirely, you can also publish the view.
197+
198+
```bash
199+
php artisan vendor:publish --provider="CodeZero\StageFront\StageFrontServiceProvider" --tag="views"
174200
```
175201

176-
Extra translations are always welcome. :)
202+
> Extra translations are always welcome. :)
177203
178-
## Laravel Debugbar
204+
## 📏 Laravel Debugbar
179205

180206
Laravel Debugbar will be disabled on the StageFront routes automatically if you use it in your project. This will hide any potential sensitive data from the public, if by accident Debugbar is running on your staging site. You can disable this feature by editing the `middleware` option in the [configuration file](#publish-configuration-file).
181207

182-
## Testing
208+
## 🚧 Testing
183209

210+
```bash
211+
composer test
184212
```
185-
vendor/bin/phpunit
186-
```
187213

188-
## Security
214+
## ☕️ Credits
215+
216+
- [Ivan Vermeyen](https://byterider.io/)
217+
- [All contributors](../../contributors)
218+
219+
## 🔓 Security
189220

190221
If you discover any security related issues, please [e-mail me](mailto:ivan@codezero.be) instead of using the issue tracker.
191222

192-
## Changelog
223+
## 📑 Changelog
193224

194-
See a list of important changes in the [changelog](https://github.com/codezero-be/laravel-stagefront/blob/master/CHANGELOG.md).
225+
See a list of important changes in the [changelog](CHANGELOG.md).
195226

196-
## License
227+
## 📜 License
197228

198-
The MIT License (MIT). Please see [License File](https://github.com/codezero-be/laravel-stagefront/blob/master/LICENSE.md) for more information.
229+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

0 commit comments

Comments
 (0)