mallardduck/metacritic-api
Composer 安装命令:
composer require mallardduck/metacritic-api
包简介
README 文档
README
Using this Metacritic API, you are able to search games on metacritic.com.
It will give you back the metacritic score, users score, genres, rating, developers and much more (see below for an example). The output is in JSON format, so it is easy to parse in both PHP or other languages.
By default it uses the URL prefix: "http://www.metacritic.com/game/pc/". If you want to search for Playstation 3 games, just change it to: "http://www.metacritic.com/game/playstation-3". See metacritic.php file.
Example
Searching on the PC game called "The Elder Scrolls V: Skyrim", will give the following JSON output:
{
"name": "The Elder Scrolls V: Skyrim",
"metascritic_score": 94,
"users_score": 8.2,
"rating": "M",
"genres": [
"Role-Playing",
"First-Person",
"First-Person",
"Western-Style"
],
"developers": [
"Bethesda Game Studios"
],
"publishers": "Bethesda Softworks",
"release_date": "Nov 10, 2011",
"also_on": [
"PlayStation 3",
"Xbox 360"
],
"also_on_url": [
"/game/playstation-3/the-elder-scrolls-v-skyrim",
"/game/xbox-360/the-elder-scrolls-v-skyrim"
],
"thumbnail_url": "http://static.metacritic.com/images/products/games/7/5988ee04196a686e107b46174f94a3ae-98.jpg",
"cheat_url": "http://www.gamefaqs.com/console/pc/code/615805.html"
}
On error
When for some reason the page couldn't be loaded / found or parsed, you will get the following JSON response:
{"error":"Page could not be loaded!"}
Or when metacritic.php is directly called, without input you will get: {"error": "Game title is empty"}
Code example
Please, see example.php
Another way to access the API is to directly call metacritic.php via the website URL:
metacritic.php?game_title=Halo%202
Be-aware that the game title needs to be URL encoded to work.
Have fun!
CI/CD
Code quality is checked in GitLab CI/CD, to avoid regression.
Currently in the pipeline:
- Psalm - Static analysis tool for PHP
- Phpcs - PHP coding style standard (
phpcbfcommand for auto-fix) - Phpmetrics - PHP metrics for complexity, object oriented, maintainability and more.
mallardduck/metacritic-api 适用场景与选型建议
mallardduck/metacritic-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 11 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mallardduck/metacritic-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mallardduck/metacritic-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2022-11-30