PHP code example of dofus-odyssey / dofusdb-php-wrapper

1. Go to this page and download the library: Download dofus-odyssey/dofusdb-php-wrapper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dofus-odyssey / dofusdb-php-wrapper example snippets


use DofusOdyssey\DofusdbPhpWrapper\QueryBuilder;
use DofusOdyssey\DofusdbPhpWrapper\ApiEndpoint;

// Find all breeds
$queryBuilder = new QueryBuilder(ApiEndpoint::BREEDS);
$queryBuilder->getQuery()->execute();

// Find all breed with a name equals to "Feca"
$queryBuilder = new QueryBuilder(ApiEndpoint::BREEDS);
$queryBuilder
    ->andWhere([
        ['field' => 'shortName.en', 'operator' => '=', 'value' => 'Feca'],
    ])
    ->getQuery()
    ->execute();

// Find all breed with a name equals to "Feca" or "Enutrof"
$queryBuilder = new QueryBuilder(ApiEndpoint::BREEDS);
$queryBuilder
    ->orWhere([
        ['field' => 'shortName.en', 'operator' => '=', 'value' => 'Feca'],
        ['field' => 'shortName.en', 'operator' => '=', 'value' => 'Enutrof'],
    ])
    ->getQuery()
    ->execute();

// Get the query parameters in string format
$queryBuilder = new QueryBuilder(ApiEndpoint::BREEDS);
$queryBuilder
    ->orWhere([
        ['field' => 'shortName.en', 'operator' => '=', 'value' => 'Feca'],
        ['field' => 'shortName.en', 'operator' => '=', 'value' => 'Enutrof'],
    ])
    ->getQuery()
    ->getRawQueryString();
// $or[0][shortName.en]=Feca&$or[1][shortName.en]=Enutrof