simbiat/lodestone-parser
Composer 安装命令:
composer require simbiat/lodestone-parser
包简介
FFXIV Lodestone parser in PHP
关键字:
README 文档
README
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('user_agent')
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 ->last_error 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\FFXIV\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 |
|
deep_dungeon[$id]['party'][$character] or deep_dungeon[$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 |
|
grand_company_ranking['weekly'][$week][$character] or grand_company_ranking['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 |
|
free_company_ranking['weekly'][$week][$character] or free_company_ranking['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 | |||
searchCharacter |
|
characters[$character], where $character is id of each character returned with respective details as an array. |
Returns array for entities from respective search function with array keys being respective entity's id on Lodestone. |
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. |
|
| Database | |||
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 for entities from respective search function with array keys being respective entity's id on Lodestone. |
getAchievementFromDB |
string $db_id - database ID for achievement taken from https://eu.finalfantasyxiv.com/lodestone/playguide/db/achievement/$db_id. |
database['achievement']['db_id'], where $db_id is ID of the achievement in the database returned with respective details as an array. |
Returns achievement details. Result is equivalent to getCharacterAchievements when getting details for 1 achievement. |
| 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 $world_details=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. |
simbiat/lodestone-parser 适用场景与选型建议
simbiat/lodestone-parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 81 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 03 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「parser」 「ffxiv」 「lodestone」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 simbiat/lodestone-parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 simbiat/lodestone-parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 simbiat/lodestone-parser 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easy to use SDK with grabber for multiple platforms at once like YouTube, Dailymotion, Facebook and more.
An MT940 bank statement parser for PHP
Laravel integration for the jsonapi.org parser
A PHP SDK for xivapi.com
A modern HTML DOM parser for PHP using DOMDocument and Symfony CssSelector.
A Lodestone Parser
统计信息
- 总下载量: 81
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2021-03-11