Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

A Laravel middleware to set a cookie for authenticated users. Useful for Varnish/FastCGI cache.

License

Notifications You must be signed in to change notification settings

The-3Labs-Team/laravel-cookie-auth

Repository files navigation

Laravel Cookie Auth

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads Maintainability

A simple middleware for Laravel applications that creates a cookie for logged-in users. Used for simple configuration with FastCGI.

Installation

You can install the package via composer:

composer require the-3labs-team/laravel-cookie-auth

You can publish the config file with:

php artisan vendor:publish --tag="laravel-cookie-auth-config"

This is the contents of the published config file:

return [
    'cookie_name' => 'skip_cache',
    'cookie_value' => true,
    'cookie_lifetime' => 5,
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="laravel-cookie-auth-views"

Usage

In your Kernel.php add the middleware as follows:

protected $middlewareGroups = [
    'web' => [
        \The3LabsTeam\LaravelCookieAuth\LaravelCookieAuth::class,
        //...

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

A Laravel middleware to set a cookie for authenticated users. Useful for Varnish/FastCGI cache.

Topics

Resources

License

Stars

Watchers

Forks

Languages