atgames / ads-php
Atgames Digital Service PHP Library
Requires
- php: >=5.3.3
- ext-curl: *
- ext-json: *
- ext-mbstring: *
Requires (Dev)
- phpunit/phpunit: ~4.0
- satooshi/php-coveralls: ~0.6.1
This package is not auto-updated.
Last update: 2024-12-30 13:59:29 UTC
README
Requirements
PHP 5.3.3 and later.
Composer
You can install the bindings via Composer. Run the following command:
composer require atgames/ads-php
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
Manual Installation
If you do not wish to use Composer, you can download the [latest release](https://gitlab.direct2drive.com/atgames/ads-php releases). Then, to use the bindings, include the init.php
file.
require_once('/path/to/ads-php/init.php');
Getting Started
Simple usage looks like:
\Ads\Ads::setApiKey('OTEwMDA6a1I2UkFTelJhUS1lcWNZSkw1blE='); $data = \Ads\Product::all(); echo $data;
Documentation
Please see https://api.atgames.net/docs/api for up-to-date documentation.
Custom Request Timeouts
To modify request timeouts (connect or total, in seconds) you'll need to tell the API client to use a CurlClient other than its default. You'll set the timeouts in that CurlClient.
// set up your tweaked Curl client $curl = new \Ads\HttpClient\CurlClient(); $curl->setTimeout(10); // default is \Ads\HttpClient\CurlClient::DEFAULT_TIMEOUT $curl->setConnectTimeout(5); // default is \Ads\HttpClient\CurlClient::DEFAULT_CONNECT_TIMEOUT echo $curl->getTimeout(); // 10 echo $curl->getConnectTimeout(); // 5 // tell Ads to use the tweaked client \Ads\ApiRequestor::setHttpClient($curl); // use the Ads API client as you normally would
Development
Install dependencies:
composer install
Tests
Install dependencies as mentioned above (which will resolve PHPUnit), then you can run the test suite:
./vendor/bin/phpunit
Or to run an individual test file:
./vendor/bin/phpunit tests/UtilTest.php