, (*1)
dexi-php-client
Dexi API Client for PHP 5.3+, (*2)
Installation
dexi-php-client is available via composer/packagist as dexi-api-client
. Install it by adding it to your composer.json file:, (*3)
"dexiio/dexi-api-client": "~1.1"
, (*4)
or, (*5)
composer require dexiio/dexi-api-client
, (*6)
Example
The following example executes a run and retrieves information for the execution:, (*7)
<?php
// Load using the composer autoloader to handle our PSR-4 namespacing
require __DIR__ . '/vendor/autoload.php';
define('CS_API_KEY', 'Your secret API Key'); // See https://app.dexi.io/#/api
define('CS_ACCOUNT_ID', 'Your account ID');
$someRunId = '59f3822f-6abc-4a01-81dc-5002a31f2dbc'; // Edit your runs inside the app to get their ID
\Dexi\Dexi::init(CS_API_KEY, CS_ACCOUNT_ID);
$newExecution = \Dexi\Dexi::runs()->execute($someRunId);
var_dump($newExecution);
Documentation
See the API documentation for details on all namespaces, methods and models. The global API object must be initialized in order to be used:, (*8)
\Dexi\Dexi::init(<your api key>, <your account id>);
, (*9)
The following API namespaces are contained in the global Dexi\Dexi
class:, (*10)
\Dexi\Dexi::executions()
\Dexi\Dexi::runs()
\Dexi\Dexi::robots()
\Dexi\Dexi::dataSets()
, (*11)
These namespaces contain the methods displayed in the API documentation. Models are defined in the \Dexi\DTO\
namespace., (*12)
Migrating from cloudscrape-client-php
Github:
cloudscrape/cloudscrape-client-php is now dexiio/dexi-php-client, (*13)
Packagist:
cloudscrape/cloudscrape-api-client is now dexiio/dexi-api-client, (*14)
If you are currently using cloudscrape-client-php, we strongly suggest you upgrade
to this library as cloudscrape-client-php has been deprecated and will no longer be developed, and may not be supported in the future. Most method
signatures have changed and we have added PSR-4 namespacing and rebranding to the Dexi name, as well as moving to support PHP7. New classes and methods
have also been added., (*15)
Old class |
New class |
CloudScrape |
\Dexi\Dexi |
CloudScrapeClient |
\Dexi\Client |
CloudScrapeExecutions |
\Dexi\Executions |
CloudScrapeRuns |
\Dexi\Runs |
\Dexi\Robots |
\Dexi\DataSets |
CloudScrapeRunDTO |
\Dexi\DTO\RunDTO |
\Dexi\DTO\RunListDTO |
CloudScrapeResultDTO |
\Dexi\DTO\ResultDTO |
CloudScrapeFileDTO |
\Dexi\DTO\FileDTO |
CloudScrapeExecutionDTO |
\Dexi\DTO\ExecutionDTO |
CloudScrapeExecutionListDTO |
\Dexi\DTO\ExecutionListDTO |
\Dexi\DTO\StatsDTO |
\Dexi\DTO\RobotDTO |
\Dexi\DTO\DataSetRowSetDTO |
\Dexi\DTO\DataSetRowQueryDTO |
CloudScrapeRequestException |
\Dexi\Exception\RequestException |
Testing
PHPUnit integration tests are provided in the test/Dexi
folder. In order to run them, a configuration.ini
file
must be created in the top-level folder with the following settings:, (*16)
[tests]
apiKey=<a valid api key>
accountId=<your account id>
# Optional fields
categoryId=<if set, will store created resources in this folder>
dataSetId=<if set, provides data set tests using this data set>
Contributing
Please submit bug reports, suggestions and pull requests to through Github., (*17)
We are more than happy to examine any pull-requests and appreciate any ideas, comments or suggestions you may have., (*18)
License
The library is available as open source under the terms of the MIT License., (*19)