Download the PHP package milhouse1337/cogul without Composer
On this page you can find all versions of the php package milhouse1337/cogul. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download milhouse1337/cogul
More information about milhouse1337/cogul
Files in milhouse1337/cogul
Package cogul
Short Description This package can secure any route in Laravel with a simple cookie.
License MIT
Homepage https://github.com/milhouse1337/cogul
Informations about the package cogul
COGUL
COokie GUard for Laravel
This package can secure any route in Laravel with a simple cookie. It will prevent anyone (or anything) to access a specific route if the cookie value you defined is not present on the request.
Installation
You can install the package via Composer:
Configuration
To generate a random token (string) you can use openssl
like this:
Add the token on your .env
file:
You can publish the config with (optional):
Here is an example config/cogul.php
file:
Usage
You have to define the routes you want to secure with the auth.cogul
middleware, like this:
Now if you GET
this /example
you will have a 403
response from Laravel.
In order to get the expected response, you need to access the following link in your browser to set the cogul
cookie:
/auth/token/random_token_here
The cookie should be stored in your browser and you will be redirected to the URL you configured.
You will now be able to access /example
normally until the cookie gets expired or deleted.
Credits
- Pascal Meunier
- All contributors
License
The MIT License (MIT). Please see License File for more information.