Skip to content
Permalink
Browse files

first

  • Loading branch information
Brian Faust
Brian Faust committed Nov 4, 2016
0 parents commit 8653dae0f23b9137f3b72caeb731e78ed667943f
@@ -0,0 +1,19 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_style = space
indent_size = 2
@@ -0,0 +1,9 @@
* text=auto

/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/README.md export-ignore
@@ -0,0 +1,3 @@
composer.lock
phpunit.xml
vendor
@@ -0,0 +1,3 @@
preset: laravel

linting: true
@@ -0,0 +1,22 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- hhvm

sudo: false

before_script:
- travis_retry composer self-update
- travis_retry composer update --no-interaction --prefer-source

script:
- if [ "$TRAVIS_PHP_VERSION" != "5.6" ]; then vendor/bin/phpunit; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi

after_script:
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi

20 LICENSE
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2016 Brian Faust <hello@brianfaust.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,56 @@
# Laravel CookieConsent

## Installation

Require this package, with [Composer](https://getcomposer.org/), in the root directory of your project.

``` bash
$ composer require faustbrian/laravel-cookie-consent
```

Add the service provider to `config/app.php` in the `providers` array.

``` php
'providers' => [
// ... Illuminate Providers
// ... App Providers
BrianFaust\CookieConsent\ServiceProvider::class
];
```

If you want you can use the [facade](http://laravel.com/docs/facades). Add the reference in `config/app.php` to your aliases array.

``` php
'aliases' => [
// ... Illuminate Facades
'CookieConsent' => BrianFaust\CookieConsent\Facades\CookieConsent::class
];
```

## Configuration

Laravel Cookie Consent supports optional configuration.

To get started, you'll need to publish all vendor assets:

```bash
$ php artisan vendor:publish --provider="BrianFaust\CookieConsent\ServiceProvider"
```

This will create a `config/cookie-consent.php` file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

## Usage

##### Render the Cookie Constent "Container"

``` php
{!! cookie_consent() !!}
```

## Security

If you discover a security vulnerability within this package, please send an e-mail to Brian Faust at hello@brianfaust.de. All security vulnerabilities will be promptly addressed.

## License

The [The MIT License (MIT)](LICENSE). Please check the [LICENSE](LICENSE) file for more details.
@@ -0,0 +1,46 @@
{
"name": "faustbrian/laravel-cookie-consent",
"description": "Easy drop-in Cookie Consent (Silktide) for Laravel 5",
"keywords": ["laravel", "framework", "Laravel-Cookie-Consent", "Laravel CookieConsent", "Brian Faust", "faustbrian"],
"license": "MIT",
"authors": [{
"name": "Brian Faust",
"email": "hello@brianfaust.de",
"homepage": "https://brianfaust.de",
"role": "Developer"
}],
"require": {
"php": "^5.6 || ^7.0",
"faustbrian/laravel-service-provider": "^1.0"
},
"require-dev": {
"graham-campbell/testbench": "^3.1",
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.0",
"scrutinizer/ocular": "~1.1",
"squizlabs/php_codesniffer": "~2.3"
},
"autoload": {
"psr-4": {
"BrianFaust\\CookieConsent\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"BrianFaust\\Tests\\CookieConsent\\": "tests"
}
},
"config": {
"preferred-install": "dist"
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
>
<testsuites>
<testsuite name="Laravel Cookie Consent Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>
@@ -0,0 +1,15 @@
<?php
return [
'message' => 'This website uses cookies to ensure you get the best experience on our website',
'dismiss' => 'Got it!',
'learnMore' => 'More info',
'link' => null,
'theme' => 'dark-bottom',
];
@@ -0,0 +1,7 @@
<!-- Begin Cookie Consent plugin by Silktide - http://silktide.com/cookieconsent -->
<script type="text/javascript">
window.cookieconsent_options = {"message": "{{ $message }}", "dismiss": "{{ $dismiss }}", "learnMore": "{{ $learnMore }}", "link": "{{ $link }}", "theme": "{{ $theme }}"};
</script>

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.10/cookieconsent.min.js"></script>
<!-- End Cookie Consent plugin -->
@@ -0,0 +1,91 @@
<?php
namespace BrianFaust\CookieConsent;
use Illuminate\Container\Container;
class Builder
{
/**
* @var
*/
private $config;
/**
* Builder constructor.
*
* @param Container $app
*/
public function __construct(Container $app)
{
$this->config = $app->config['cookie-consent'];
}
/**
* @param $value
*
* @return $this
*/
public function message($value)
{
$this->config['message'] = $value;
return $this;
}
/**
* @param $value
*
* @return $this
*/
public function dismiss($value)
{
$this->config['dismiss'] = $value;
return $this;
}
/**
* @param $value
*
* @return $this
*/
public function learnMore($value)
{
$this->config['learnMore'] = $value;
return $this;
}
/**
* @param $value
*
* @return $this
*/
public function link($value)
{
$this->config['link'] = $value;
return $this;
}
/**
* @param $value
*
* @return $this
*/
public function theme($value)
{
$this->config['theme'] = $value;
return $this;
}
/**
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function render()
{
return view('cookie-consent::container', $this->config);
}
}
@@ -0,0 +1,16 @@
<?php
namespace BrianFaust\CookieConsent\Facades;
use Illuminate\Support\Facades\Facade;
class CookieConsent extends Facade
{
/**
* @return string
*/
protected static function getFacadeAccessor()
{
return 'cookie-consent';
}
}

0 comments on commit 8653dae

Please sign in to comment.
You can’t perform that action at this time.