1. Go to this page and download the library: Download izaghar/xivapi-laravel 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/ */
use XivApi\Laravel\Facades\XivApi;
// Fetch an item
$item = XivApi::sheet('Item')->row(4)->get();
// Search with query string
$results = XivApi::search()
->query('+Name~"Potion" +LevelItem>=10')
->sheets(['Item'])
->get();
// Search with SearchQuery builder
use XivApi\Query\SearchQuery;
$results = XivApi::search()
->query(SearchQuery::where('Name')->contains('Potion'))
->sheets(['Item'])
->get();
// Override global settings per-request
$item = XivApi::sheet('Item')
->row(4)
->language(Language::German)
->get();
use XivApi\XivApi;
class ItemController extends Controller
{
public function show(XivApi $api, int $id)
{
return $api->sheet('Item')->row($id)->get();
}
}
$api = app(XivApi::class);
$item = $api->sheet('Item')->row(4)->get();
// Or using the alias
$api = app('xivapi');
use Spatie\LaravelData\Data;
use XivApi\Laravel\Normalizers\XivApiNormalizer;
class ItemData extends Data
{
public function __construct(
public int $rowId,
public array $fields,
) {}
public static function normalizers(): array
{
return [
XivApiNormalizer::class,
];
}
}
use XivApi\Laravel\Facades\XivApi;
$response = XivApi::sheet('Item')->row(4)->get();
$item = ItemData::from($response);