2017 © Pedro Peláez
 

library consent

Helper interface for user consent in laravel projects

image

origami/consent

Helper interface for user consent in laravel projects

  • Monday, May 21, 2018
  • by papertank
  • Repository
  • 2 Watchers
  • 2 Stars
  • 97 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 143 % Grown

The README.md

Laravel Consent Build Status

About

The origami/consent helper package contains a Laravel model trait to make saving, comparing and revoking consent easier. The package saves all updates to consent to the consent table and provides a GivesConsent trait for models like the User model., (*1)

The necessity for the package came about through GDPR and the UK Information Commissioner's Office guidance on "Consent"., (*2)

Installation

This package is designed for Laravel >= 6.0. You can pull in this package through composer., (*3)

composer require origami/consent

You should publish the consent table migration with:, (*4)

php artisan vendor:publish --provider="Origami\Consent\ConsentServiceProvider" --tag="migrations"

The migrate the database:, (*5)

php artisan migrate

Usage

To use the package, add the GivesConsent trait to a model you'd like to track consent for., (*6)


use Origami\Consent\GivesConsent; class User extends Model { use GivesConsent; }

You can mark explicit consent given like this:, (*7)

$model->giveConsentTo('consent-name');

GDPR requires you to keep a record of exactly what was shown at the time. You can do this in the text attribute, and pass anything extra in meta, (*8)

$model->giveConsentTo('consent-name', [
  'text' => 'You are consenting to ...',
  'meta' => [
    'ip' => '192.168.0.1',
  ]
]);

You can revoke a user's consent like so:, (*9)

$model->revokeConsentTo('consent-name');

You can check if consent is given like so:, (*10)

if ( $model->hasGivenConsent('consent-name') ) {

}

If consent has not been set, the default is false. You can change that in the 2nd paramter., (*11)

if ( $model->hasGivenConsent('consent-name', true) ) {

}

You can get the user's current consent status like so. This will be an instance of Origami\Consent\Consent, (*12)

$consent = $model->getConsent('consent-name');

Contributing

Please submit improvements and fixes :), (*13)

Author

Papertank Limited, (*14)

License

View the license, (*15)

The Versions

21/05 2018
11/05 2018

0.2.2

0.2.2.0

Helper interface for user consent in laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar papertank

10/05 2018

0.2.1

0.2.1.0

Helper interface for user consent in laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar papertank

09/05 2018

0.2.0

0.2.0.0

Helper interface for user consent in laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar papertank

25/04 2018

0.1.0

0.1.0.0

Helper interface for user consent in laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar papertank