PHPackages                             milhouse1337/cogul - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. milhouse1337/cogul

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

milhouse1337/cogul
==================

This package can secure any route in Laravel with a simple cookie.

v1.02(7y ago)53.0kMITPHPPHP &gt;=5.6

Since Jun 16Pushed 7y agoCompare

[ Source](https://github.com/milhouse1337/cogul)[ Packagist](https://packagist.org/packages/milhouse1337/cogul)[ Docs](https://github.com/milhouse1337/cogul)[ RSS](/packages/milhouse1337-cogul/feed)WikiDiscussions master Synced today

READMEChangelog (3)DependenciesVersions (4)Used By (0)

COGUL
=====

[](#cogul)

**CO**okie **GU**ard for **L**aravel

[![Latest Version on Packagist](https://camo.githubusercontent.com/c6bd0ef524bbf14efa9ea905638f28712fb684b964b916832ba785bd47a11727/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696c686f757365313333372f636f67756c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/milhouse1337/cogul)[![Total Downloads](https://camo.githubusercontent.com/28344a763778346b4f64545da3d574840a2b7201fc972abcd1309c6598b7e91a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696c686f757365313333372f636f67756c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/milhouse1337/cogul)

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
------------

[](#installation)

You can install the package via Composer:

```
composer require milhouse1337/cogul
```

Configuration
-------------

[](#configuration)

To generate a random token (string) you can use `openssl` like this:

```
openssl rand -hex 32
```

Add the token on your `.env` file:

```
COGUL_TOKEN=random_token_here

```

You can publish the config with (optional):

```
php artisan vendor:publish --provider="Milhouse1337\Cogul\CogulServiceProvider"
```

Here is an example `config/cogul.php` file:

```
return [
    'token'      => env('COGUL_TOKEN', ''),
    'url'        => env('COGUL_URL', '/auth/token/{token}'),
    'redirect'   => env('COGUL_REDIRECT', '/'),
    'cookie'     => env('COGUL_COOKIE', 'cogul'),
    'expiration' => env('COGUL_EXPIRATION', 2628000), // 5 years.
    'middleware' => env('COGUL_MIDDLEWARE', 'web'),
    'whitelist'  => [],
];
```

Usage
-----

[](#usage)

You have to define the routes you want to secure with the `auth.cogul` middleware, like this:

```
Route::get('example', 'Controller@example')->middleware('auth.cogul');
```

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
-------

[](#credits)

- [Pascal Meunier](https://github.com/milhouse1337)
- [All contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

2573d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/326740?v=4)[Pascal Meunier](/maintainers/milhouse1337)[@milhouse1337](https://github.com/milhouse1337)

---

Top Contributors

[![milhouse1337](https://avatars.githubusercontent.com/u/326740?v=4)](https://github.com/milhouse1337 "milhouse1337 (5 commits)")

---

Tags

cookieguardlaravelpackagephp

### Embed Badge

![Health badge](/badges/milhouse1337-cogul/health.svg)

```
[![Health](https://phpackages.com/badges/milhouse1337-cogul/health.svg)](https://phpackages.com/packages/milhouse1337-cogul)
```

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.3M17](/packages/kartik-v-yii2-password)[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
