PHPackages                             riclep/cookie-law - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. riclep/cookie-law

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

riclep/cookie-law
=================

A very basic cookie law package for legacy Laravel 4 projects

0.0.8(3y ago)088MITBladePHP &gt;=5.4.0

Since Sep 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/RicLeP/cookie-law)[ Packagist](https://packagist.org/packages/riclep/cookie-law)[ RSS](/packages/riclep-cookie-law/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (1)Versions (9)Used By (0)

A simple package for adding cookie consent messages to legacy Laravel 4 websites
--------------------------------------------------------------------------------

[](#a-simple-package-for-adding-cookie-consent-messages-to-legacy-laravel-4-websites)

Shows a dialog with a message and button to accept cookies. The default name of the acceptance cookie is: `laravel_cookie_acceptance`. You are responsible for implementing logic based on their acceptance!

\###Chacking acceptance with Blade

```
@if (isset($_COOKIE[Config::get('cookie-law::cookie-law.cookie_name')]))
	// Cookie is accepted to do stuff here
@endif

```

\###Installation

`composer require riclep/cookie-law`

Add the Service Provider

`'RicLeP\CookieLaw\CookieLawServiceProvider',` to `config/app`

Include the Blade view in your template near the bottom.

`@include('cookie-law::dialog')`

If you want to edit anything then publish the config file

`php artisan config:publish riclep/cookie-law`

To create the cookies page copy the controller and view stubs from the package and adjust them to fit the site. You can then add the following line to the routes file:

`Route::get(Config::get('cookie-law::cookie-law.cookie_url'), 'CookiesController@view');`

To override the wording create a language file in `app/lang/packages/{locale}/cookie-law/lang.php` with the contents:

```
