PHP code example of xivapi / xivapi-php

1. Go to this page and download the library: Download xivapi/xivapi-php 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/ */

    

xivapi / xivapi-php example snippets


$api = new \XIVAPI\XIVAPI();

$api->environment->key('my_api_key');

$api->content->[contentName]()->list();
$api->content->[contentName]()->one($id);

// examples
$item = $api->content->item()->one(1675);
$action = $api->content->action()->one(127);
$instances = $api->content->instanceContent()->list();

// non dynamic methods:
$api->content->list();
$api->content->servers();
$api->content->serversByDataCenter();

$api->search->find($string)->results();

// The column to search on
$api->search->findColumn($column);

// the algorithm to use
$api->search->findAlgorithm($searchStringAlgorithm);

// the page to start on
$api->search->page($number);

// sorting order
$api->search->sort($field, $order);

// limit results
$api->search->limit($limit);

// columns in the results
$api->search->columns($columns);

// change elastics filter bool condition (eg: should, must, must_not)
$api->search->bool($bool);

$api->search
    ->filter('LevelItem', 30, SearchFilters::GREATER_THAN)
    ->filter('ItemSearchCategory', 10, SearchFilters::GREATER_THAN_OR_EQUAL_TO);

$api->character->search($name, $server, $page);
$api->character->get($id, $data = [], $extended = false);
$api->character->verify($id);
$api->character->update($id);
$api->character->delete($id);

$api->freecompany->search($name, $server, $page);
$api->freecompany->get($id, $data = []);
$api->freecompany->update($id);
$api->freecompany->delete($id);

$api->linkshell->search($name, $server, $page);
$api->linkshell->get($id, $data = []);
$api->linkshell->update($id);
$api->linkshell->delete($id);

$api->pvpteam->search($name, $server, $page);
$api->pvpteam->get($id, $data = []);
$api->pvpteam->update($id);
$api->pvpteam->delete($id);