checkmango / php-sdk
The PHP SDK for Checkmango
Fund package maintenance!
jbrooksuk
Requires
- php: ^7.3 || ^8.0
- ext-json: *
- php-http/cache-plugin: ^1.7.1
- php-http/client-common: ^2.3
- php-http/discovery: ^1.12
- php-http/httplug: ^2.2
- php-http/multipart-stream-builder: ^1.1.2
- psr/cache: ^1.0
- psr/http-client-implementation: ^1.0
- psr/http-factory-implementation: ^1.0
- psr/http-message: ^1.0
- symfony/polyfill-php80: ^1.17
Requires (Dev)
- ext-json: *
- guzzlehttp/guzzle: ^7.2
- http-interop/http-factory-guzzle: ^1.0
- php-http/mock-client: ^1.4.1
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-11-11 21:32:52 UTC
README
This project is heavily inspired by Graham Campbell's packages; Bitbucket and GitLab.
Installation
This version supports PHP 7.2-8.2. To get started, require the project using Composer. You will also need to install packages that provide psr/http-client-implementation
and psr/http-factory-implementation
.
Standard Installation
composer require "checkmango/php-sdk:dev-master" "guzzlehttp/guzzle:^7.2" "http-interop/http-factory-guzzle:^1.0"
Laravel Installation
composer require "checkmango/laravel:dev-master" "guzzlehttp/guzzle:^7.2" "http-interop/http-factory-guzzle:^1.0"
Usage
// Authentication $client = new Checkmango\Client(); $client->authenticate('your_api_token'); // Example API Call $experiment = $client->teams($teamId)->experiments()->show('EXPERIMENT_KEY'); $client->teams($teamId)->ingest()->store('EXPERIMENT_KEY', 'PARTICIPANT_KEY', 'VARIANT_KEY'); // Track impression $client->teams($teamId)->ingest()->store('EXPERIMENT_KEY', 'PARTICIPANT_KEY', 'VARIANT_KEY', 'EVENT_KEY'); // Track conversion
Example with Pager
The Pager
class allows you to easily retrieve all results across multiple pages of results.
$pager = new Checkmango\ResultPager($client); $experiments = $pager->fetchAll($client->teams($teamId)->experiments(), 'all');
Security
If you discover a security vulnerability within this package, please email James Brooks at james@checkmango.com. All security vulnerabilities will be promptly addressed. You may view our full security policy here.
License
Checkmango PHP SDK is licensed under The MIT License (MIT).