webmarketer / webmarketer-plugin-core-php
2.2.0
2024-04-09 14:24 UTC
Requires
- php: ^5.5 || ^7.0 || ^8.0
- webmarketer/webmarketer-php: ^3.4
Requires (Dev)
- phpunit/phpunit: ^5.7.27 || >= 6.5.14
README
PHP Core plugin for Webmarketer tiers integrations
The official PHP Core bundle for Webmarketer plugins.
Install
To add this package, your project must meet several requirements :
- PHP >= 5.6
- Composer (install composer)
This package is the core used by all Webmarketer tiers integrations and plugins (WordPress, Prestashop). It provides interfaces and utilities for any plugin.
It is not designed to work as a standalone and must be used along a plugin implementation.
This package wrap the PHP SDK for Webmarketer. Thereby, check that your project meet the SDK requirements too.
composer require webmarketer/webmarketer-php-core-plugin
Usage
try { // create an instance of the SDK with the desired configuration $client = new \Webmarketer\WebmarketerSdk([ 'credential' => '{ ...jsonSa }', 'scopes' => 'test', 'default_project_id' => 'webmarketer-awesome-project' ]); } catch (\Webmarketer\Exception\DependencyException $dep_ex) { // SDK init throw a dependency exception if requirements are not meet (see Install) } catch (\Webmarketer\Exception\CredentialException $cred_ex) { // SDK automatically try to authenticate you agains API // A credential exception could be throw if credentials are invalid } // SDK exposes resources services, use them to manipulate your resources $event_type_service = $client->getEventTypeService(); $field_service = $client->getFieldService();
Integrations based on this package
Contributing
All SDK dependencies are managed via Composer :
composer install
Run all tests with PHPUnit and the configuration provided :
composer tests
Run all tests and check codecoverage (must be >= 80%) with PHPUnit :
composer tests-coverage
Lint code :
composer phpcs
Feel free to report issues and bugs directly on this repository.