{"id":26934975,"url":"https://github.com/silverbackstudio/php-iubenda-consent-solution","last_synced_at":"2025-04-02T11:16:42.854Z","repository":{"id":32771875,"uuid":"141976805","full_name":"silverbackstudio/php-iubenda-consent-solution","owner":"silverbackstudio","description":"PHP client for Iubenda Consent Solution HTTP API","archived":false,"fork":false,"pushed_at":"2021-12-01T16:34:59.000Z","size":8,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-22T02:01:29.392Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/silverbackstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-23T07:19:52.000Z","updated_at":"2018-07-24T10:06:27.000Z","dependencies_parsed_at":"2022-08-07T18:01:28.209Z","dependency_job_id":null,"html_url":"https://github.com/silverbackstudio/php-iubenda-consent-solution","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverbackstudio%2Fphp-iubenda-consent-solution","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverbackstudio%2Fphp-iubenda-consent-solution/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverbackstudio%2Fphp-iubenda-consent-solution/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverbackstudio%2Fphp-iubenda-consent-solution/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silverbackstudio","download_url":"https://codeload.github.com/silverbackstudio/php-iubenda-consent-solution/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246802624,"owners_count":20836373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-02T11:16:40.188Z","updated_at":"2025-04-02T11:16:41.967Z","avatar_url":"https://github.com/silverbackstudio.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Iubenda Consent Solution PHP client library\n\n## Installation\n\nInstall this package in Yii project root with [Composer](https://getcomposer.org/).\n\n`composer require silverback/iubenda-consent-solution`\n\n## Usage\n\n### Create a new consent\n\n```php\n\nuse Iubenda\\ConsentSolution\\Client;\nuse Iubenda\\ConsentSolution\\Consent;\n\n$consentSolution = new ConsentSolution\\Client( 'your-private-api-key' );\n$consent = new ConsentSolution\\Consent;\n\n$user_id = 10;\n\n$consent-\u003esetSubject( \n    [\n        'id' =\u003e sha1( 'my_application_' . $user_id ), // you can omit this field\n        'email' =\u003e 'user@example.com',\n        'first_name' =\u003e 'John',\n        'last_name' =\u003e 'Doe',\n        'full_name' =\u003e 'John Doe',\n        'verified' =\u003e false\n    ]\n);\n\n$consent-\u003eaddLegalNotice( [ 'identifier' =\u003e 'privacy_policy' ] );            \n\n$consent-\u003eaddProof( [\n    'content' =\u003e json_encode( [ \n        'first_name' =\u003e 'John', \n        'last_name' =\u003e 'Doe', \n        // other useful form fields\n    ] ),\n    'form' =\u003e '\u003cform\u003e\u003cinput type=\"text\" name=\"first_name\"\u003e[...]\u003c/form\u003e',\n] );\n\n$consent-\u003epreferences['privacy_policy'] = true;\n$consent-\u003epreferences['third_party'] = false;\n$consent-\u003epreferences['newsletter'] = true;\n\ntry {\n    $saved_consent = $consentSolution-\u003ecreateConsent( $consent );\n    echo \"Successfully saved consent: \" . $saved_consent-\u003eid;\n} catch (\\Exception $e) {\n    echo \"An error occurred: \" . $e-\u003egetMessage();\n}\n\n```\n\n## Testing\n\nThis class uses [PHPUnit](https://phpunit.de/) as test suite, to test the classes and functions follow this steps.\n\nCopy the file `phpunit.xml.dist` in `phpunit.xml` in the library folder and define Api-Key and addresses inside it:\n\n```xml\n\t\u003cphp\u003e\n        \u003cconst name=\"CONSENT_SOLUTION_API_KEY\" value=\"foobar\"/\u003e\t\t\t\n        \u003cconst name=\"CONSENT_SOLUTION_TEST_CONSENT\" value=\"foobar\"/\u003e\t\t\t\n        \u003cconst name=\"CONSENT_SOLUTION_TEST_SUBJECT\" value=\"foobar\"/\u003e\t\t\t        \n        ...\n\t\u003c/php\u003e\n```\n\nLaunch a `composer update` to install all the dependencies and test suite.\n\nRun the test with the following commands\n\n```bash\n./vendor/bin/phpunit  tests/  # all tests\n./vendor/bin/phpunit  tests/ClientTest # single test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilverbackstudio%2Fphp-iubenda-consent-solution","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilverbackstudio%2Fphp-iubenda-consent-solution","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilverbackstudio%2Fphp-iubenda-consent-solution/lists"}