A package to protect your work in progress from prying eyes
Imagine you are working on new app. Your client wants to see the progress that you've made. However your site isn't ready for prime time yet. Sure, you could create some login functionality and display the site only to logged in users. But why bother creating users when there is a more pragmatic approach?
At Spatie we often instruct a client to visit /demo
. Visiting that url will unlock access to the entire front site. Because creating packages has many benefits we decided to open source our solution.
Our newly released laravel-demo-mode package blocks your work in progress from prying eyes. After it is installed you can use a route macro to register a route that grants access to the protected routes:
Route::demoAccess('/demo');
Routes can be protected by using the demoMode
-middleware on them:
Route::group(['middleware' => 'demoMode'], function () {
Route::get('/secret-route', 'SecretController@index');
});
Unless a user has first visited /demo
first, he or she will be redirected to /under-construction
. This url can be changed in the config file.
A word to the wise: do not use this package to restrict access to sensitive data or to protect an admin section. For those cases you should use proper authentication.
You can take a look at the package on GitHub. If you like it, you might like some of our other Laravel packages as well.
What are your thoughts on "A package to protect your work in progress from prying eyes"?