Skip to content

Commit b749628

Browse files
committed
Update README
1 parent a3a30ff commit b749628

File tree

1 file changed

+67
-35
lines changed

1 file changed

+67
-35
lines changed

README.md

Lines changed: 67 additions & 35 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,9 +80,10 @@ 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

67-
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.
85+
If you have existing users in the database and want to use those credentials, you can set `STAGEFRONT_DATABASE` to `true`.
86+
The above login and password settings will then be ignored.
6887

6988
| Option | Type | Default |
7089
| ------------------------------------ | -------- | ---------- |
@@ -78,7 +97,9 @@ If you want to grant access to just a few of those users, you can whitelist them
7897

7998
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.
8099

81-
## Change Route URL
100+
## ⚙️ Other Options
101+
102+
#### ☑️ Change Route URL
82103

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

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

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

95-
## Throttle Login Attempts
116+
#### ☑️ Throttle Login Attempts
96117

97118
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.
98119

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

123144
![Throttle Screen](screenshots/screenshot-throttled.png)
124145

125-
## Ignore URLs
146+
#### ☑️ Ignore URLs
126147

127148
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.
128149

@@ -137,7 +158,7 @@ For example:
137158
],
138159
```
139160

140-
## Link Live Site
161+
#### ☑️ Link Live Site
141162

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

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

148169
Make sure you enter the full URL, including `https://`.
149170

150-
## Change App Name
171+
#### ☑️ Change App Name
151172

152173
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:
153174

154175
| Option | Type | Default |
155176
| --------------------- | -------- | -------------------- |
156177
| `STAGEFRONT_APP_NAME` | `string` | `config('app.name')` |
157178

158-
## Publish Configuration File
179+
## 📇 Publish Configuration File
159180

160181
You can also publish the configuration file.
161182

162-
```
163-
php artisan vendor:publish
183+
```bash
184+
php artisan vendor:publish --provider="CodeZero\StageFront\StageFrontServiceProvider" --tag="config"
164185
```
165186

166187
Each option is documented.
167188

168-
## Translations and Views
189+
## 📑 Translations and Views
169190

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.
191+
You can publish the translations to quickly adjust the text on the login screen and the errors.
171192

193+
```bash
194+
php artisan vendor:publish --provider="CodeZero\StageFront\StageFrontServiceProvider" --tag="lang"
172195
```
173-
php artisan vendor:publish
196+
197+
If you want to customize the login page entirely, you can also publish the view.
198+
199+
```bash
200+
php artisan vendor:publish --provider="CodeZero\StageFront\StageFrontServiceProvider" --tag="views"
174201
```
175202

176-
Extra translations are always welcome. :)
203+
> Extra translations are always welcome. :)
177204
178-
## Laravel Debugbar
205+
## 📏 Laravel Debugbar
179206

180207
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).
181208

182-
## Testing
209+
## 🚧 Testing
183210

211+
```bash
212+
composer test
184213
```
185-
vendor/bin/phpunit
186-
```
187214

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

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

192-
## Changelog
224+
## 📑 Changelog
193225

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

196-
## License
228+
## 📜 License
197229

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

0 commit comments

Comments
 (0)