maartenstaa / gameanalytics-php
PHP wrapper for the GameAnalytics REST API.
Requires
- php-http/client-implementation: ^1.0
- php-http/discovery: ^0.8
Requires (Dev)
- php-http/guzzle6-adapter: ~1
- php-http/message: ^1.0
- phpunit/phpunit: ~4
- puli/composer-plugin: ^1.0
This package is auto-updated.
Last update: 2024-11-04 23:06:53 UTC
README
PHP wrapper for the GameAnalytics REST API.
Installation
Using Composer, add the package to your require
section.
{ "require": { "maartenstaa/gameanalytics-php": "~2" } }
This package requires you to select an HTTP client to be used. For more information, read the documentation.
Usage
First, create a client using the game key and associated secret key. The third parameter is the HTTP client you want to use. If you do not provide it, the package will try to auto-detect which one is available. The fourth and final parameter is the HTTP message factory you wish to use. Again, if you do not provide it, the package will try to auto-detect which is available.
use MaartenStaa\GameAnalytics\Client; $client = new Client($gameKey, $secretKey);
Next, you can use the "init" and "event" functions on the client to get a message instance. Use the set() function to configure the required parameters (refer to the official documentation) and use send() to send the message. You will receive a PSR-7 response object.
$client->init()->set(array(...))->send(); $message = $client->event('user'); $message->set('foo', 'bar') ->set('baz', 'bax') ->send();
Contributing
Coding standard
All code is to follow the PSR-2 coding standard.
Unit tests
If you find a bug, feel free to send a pull request to fix it, but make sure to always include a regression test.