2017 © Pedro Peláez
 

library iubenda-consent-solution

PHP client for Iubenda Consent Solution HTTP API

image

silverback/iubenda-consent-solution

PHP client for Iubenda Consent Solution HTTP API

  • Tuesday, July 24, 2018
  • by brandomeniconi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Iubenda Consent Solution PHP client library

Installation

Install this package in Yii project root with Composer., (*1)

composer require silverback/iubenda-consent-solution, (*2)

Usage


use Iubenda\ConsentSolution\Client; use Iubenda\ConsentSolution\Consent; $consentSolution = new ConsentSolution\Client( 'your-private-api-key' ); $consent = new ConsentSolution\Consent; $user_id = 10; $consent->setSubject( [ 'id' => sha1( 'my_application_' . $user_id ), // you can omit this field 'email' => 'user@example.com', 'first_name' => 'John', 'last_name' => 'Doe', 'full_name' => 'John Doe', 'verified' => false ] ); $consent->addLegalNotice( [ 'identifier' => 'privacy_policy' ] ); $consent->addProof( [ 'content' => json_encode( [ 'first_name' => 'John', 'last_name' => 'Doe', // other useful form fields ] ), 'form' => '
[...]
', ] ); $consent->preferences['privacy_policy'] = true; $consent->preferences['third_party'] = false; $consent->preferences['newsletter'] = true; try { $saved_consent = $consentSolution->createConsent( $consent ); echo "Successfully saved consent: " . $saved_consent->id; } catch (\Exception $e) { echo "An error occurred: " . $e->getMessage(); }

Testing

This class uses PHPUnit as test suite, to test the classes and functions follow this steps., (*3)

Copy the file phpunit.xml.dist in phpunit.xml in the library folder and define Api-Key and addresses inside it:, (*4)

    <php>
        <const name="CONSENT_SOLUTION_API_KEY" value="foobar"/>         
        <const name="CONSENT_SOLUTION_TEST_CONSENT" value="foobar"/>            
        <const name="CONSENT_SOLUTION_TEST_SUBJECT" value="foobar"/>                    
        ...
    </php>

Launch a composer update to install all the dependencies and test suite., (*5)

Run the test with the following commands, (*6)

./vendor/bin/phpunit  tests/  # all tests
./vendor/bin/phpunit  tests/ClientTest # single test

The Versions

24/07 2018

dev-master

9999999-dev

PHP client for Iubenda Consent Solution HTTP API

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

php client gdpr iubenda consent-solution psr3-log

24/07 2018

1.0.0

1.0.0.0

PHP client for Iubenda Consent Solution HTTP API

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

php client gdpr iubenda consent-solution psr3-log