Download the PHP package simbiat/lodestone-parser without Composer
On this page you can find all versions of the php package simbiat/lodestone-parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package lodestone-parser
Final Fantasy XIV: Lodestone PHP Parser
This project is PHP library for parsing data directly from the FFXIV Lodestone website initially based on one developed by @viion, but now completely rewritten. Previously was its branch.
The goal is to provide an extremely fast and lightweight library, it is built with the purpose of parsing as many characters as possible, key being: low memory, and micro-timed parsing methods.
Notes
- This library parses the live Lodestone website. This website is based in Tokyo.
- This library is built in PHP 8 minimum, please use the latest as this can increase
What's different?
This is what's different from original library from @viion:
- It has different code structure, that aims at reduction of rarely used or unnecessary functions and some standardization.
- Using regex instead of full HTML parsing for extra speed (and arrays instead of objects as result). It does not mean, that this will always be faster than using Symphony-based functions but will be true on average.
- More filters for your search queries.
- Return more potentially useful information where possible.
- Attempt at multilingual support. Some filters even support actual "names" used on Lodestone (instead of just IDs).
- Ability to "link" different types of entities, requesting several pages in one object. For example, you can get both Free Company and its members' details in same object.
Settings
It's possible to set your own UserAgent used by CURL: simply use ->setUseragent('useragent')
It's also possible to change LodeStone language by ->setLanguage('na')
. Accepted language values are na
, eu
, jp
, fr
, de
It's possible to utilize Benchmarking to get parsing times for each iteration by ->setBenchmark(true)
Error handling
In the new concept fatal errors generally can happen only during HTTP requests. In order not to break "linking" function, they are handled softly in the code itself and are reported to ->errors
and ->lasterror
arrays. In essence, when an error occurs you will simply get an empty result for specific entity, and it will not be added to output.
To get last error you can use ->getLastError($close)
. For list of all errors - -getErrors($close)
. $close
is an expected boolean, that, if set to true
, will close the cURL handle. It is set to false
by default, based on assumption, that you are using these only for some kind of validation.
All pages
All parsers accepting page
number support value of 0
, which will return all pages (that is run the respective parser recursively). Default value for page
is set to 1
to limit resources used.
Test script
There is a \Simbiat\LodestoneTest
class to test run all the available functions in some general scenarios. Run it to get samples of output formatting and timings for each type of test in a table format. Note, that the last 2 tests are 'error tests', so their results are purposefully reversed for the report's consistency. Additionally, achievements' test is purposefully ran with details
set to true and Free Company members in All pages
mode, because of this their benchmark results will be presented as list of timings.
Getting results
To get results of parsers (listed below) you need to run ->getResult($close)
, which will return the array with the results. $close
is an expected boolean, that, if set to true
, will close the cURL handle. It is set to true
by default, based on assumption, that getting results will be your last action.
NOTICE: if you are not calling ->getResult($close)
at all or are calling it only with false
, it's recommended to explicitly unset the object you are using, unless you are using to free up resources.
Parsers
Function | Parameters (in required order) | Return key | Description |
---|---|---|---|
Characters | |||
getCharacter |
$id - id of character. |
characters[$character] , where $character is id of character returned with respective details as an array. |
Returns character details. |
getCharacterJobs |
$id - id of character. |
characters[$id]['jobs'] , where $id is id of character. |
Returns character jobs' details. |
getCharacterFriends |
|
characters[$id]['friends'][$character] , where $id is id of character and $character is id of friends returned with respective details as an array. |
Returns character's friends. |
getCharacterFollowing |
|
characters[$id]['followed'][$character] , where $id is id of character and $character is id of followed characters returned with respective details as an array. |
Returns characters followed by selected one. |
getCharacterAchievements |
|
characters[$character]['achievements'][$achievement] , where $character is id of character and $achievement is id of achievement returned with respective details as an array. |
Returns character's achievements, if they are public. |
Groups | |||
getFreeCompany |
$id - id of Free Company. |
freecompanies[$freecompany] , where $freecompany is id of Free Company returned with respective details as an array. |
Returns information about Free Company without members. |
getFreeCompanyMembers |
|
freecompanies[$freecompany][$character] , where $freecompany is id of Free Company and $character is id of each member returned with respective details as an array. |
Returns requested members' page of the Free Company. |
getLinkshell |
|
linkshells[$linkshell] , where $linkshell is id of linkshell returned with respective details as an array. |
Returns requested member's page of the Linkshell and general information. |
getPvPTeam |
$id - id of PvP Team. |
pvpteams[$pvpteam] , where $pvpteam is id of PvP Team returned with respective details as an array. |
Returns general information and members of PvP Team. |
Ranking | |||
getFeast |
|
feast[$season][$character] , where $season is the value passed at call and $character is id of each character returned with respective details as an array. |
Returns The Feasts rankings for requested season, server and/or rank. |
getDeepDungeon |
|
deepdungeon[$id]['party'][$character] or deepdungeon[$id]['solo'][$subtype][$character] , where $id is id of the dungeon, $subtype is common 3-letter abbreviation of the respective job and $character is id of each character returned with respective details as an array. |
Returns ranking of respective Deep Dungeon. |
getFrontline |
|
frontline['weekly'][$week][$character] or frontline['monthly'][$month][$character] , where $week and $month is identification of request week or month and $character is id of each character returned with respective details as an array. |
Returns Frontline rankings for selected period. |
getGrandCompanyRanking |
|
GrandCompanyRanking['weekly'][$week][$character] or GrandCompanyRanking['monthly'][$month][$character] , where $week and $month is identification of request week or month and $character is id of each character returned with respective details as an array. |
Returns Grand Company rankings for selected period. |
getFreeCompanyRanking |
|
FreeCompanyRanking['weekly'][$week][$character] or FreeCompanyRanking['monthly'][$month][$character] , where $week and $month is identification of request week or month and $character is id of each character returned with respective details as an array. |
Returns Free Company rankings for selected period. |
Search | |||
searchDatabase |
|
database[$type][$entityid] , where $type is type of entities searched, and $entityid is ID of the entity in the database returned with respective details as an array. |
Returns array fo entities from respective search function with array keys being respective entity's id on Lodestone. |
searchCharacter |
|
characters[$character] , where $character is id of each character returned with respective details as an array. |
|
searchFreeCompany |
|
freecompanies[$freecompany] , where $freecompany is id of each Free Company returned with respective details as an array. |
|
searchLinkshell |
|
linkshells[$linkshell] , where $linkshell is id of each linkshell returned with respective details as an array. |
|
searchPvPTeam |
|
pvpteams[$pvpteam] , where $pvpteam is id of each PvP Team returned with respective details as an array. |
|
News | |||
getLodestoneNews |
news |
Returns news as seen on main page of Lodestone. | |
getLodestoneTopics |
int $page=1 - number of the page to parse. Defaults to 1 . |
topics |
Return respective news subcategories. |
getLodestoneNotices |
notices |
||
getLodestoneMaintenance |
maintenance |
||
getLodestoneUpdates |
updates |
||
getLodestoneStatus |
status |
||
Special | |||
getLodestoneBanners |
banners |
Returns banners from Lodestone. | |
getWorldStatus |
bool $worldDetails=false - whether to show detailed status of worlds or not. Defaults to false . |
worlds |
Returns alphabet sorted array with worlds (servers) names as array keys and status (online/offline) as values. In detailed mode shows online status, maintenance status, whether world is preferred or congested and whether world can have new characters as boolean values. |
All versions of lodestone-parser with dependencies
ext-curl Version *
ext-mbstring Version *