velkuns/artifactsmmo-client
Composer 安装命令:
composer require velkuns/artifactsmmo-client
包简介
PHP Client for Artifacts MMO Game Code
README 文档
README
Why?
This SDK / Client is a wrapper to call Artifacts MMO API. Each clients methods call and endpoint and return a Value Object as defined in OpenAPI Spec from Artifacts MMO API.
Artifacts MMO API Doc: https://api.artifactsmmo.com/docs/
When POST endpoint need a BODY, an Body* Value Object (VO) is required to call the endpoint. If any query param is available, you can also pass it to the endpoint (PHP doc is set for params with name in this case)
Installation
If you wish to install it in your project, require it via composer:
composer require velkuns/artifactsmmo-client
Usage
Usage:
<?php declare(strict_types=1); namespace Application; use Eureka\Component\Curl\HttpClient; use Nyholm\Psr7\Factory\Psr17Factory; use Psr\Log\NullLogger; use Velkuns\ArtifactsMMO\Client\Client; use Velkuns\ArtifactsMMO\Client\MyClient; use Velkuns\ArtifactsMMO\Config\ArtifactsMMOConfig; use Velkuns\ArtifactsMMO\Request\RequestBuilder; use Velkuns\ArtifactsMMO\VO\Body\BodyCrafting; use Velkuns\ArtifactsMMO\VO\Body\BodyDestination; require_once(__DIR__ . '/../vendor/autoload.php'); $token = ''; // Your token //~ Config part $config = new ArtifactsMMOConfig('api.artifactsmmo.com', 'https', $token); //~ Client dependencies $httpClient = new HttpClient(userAgent: 'artifactsmmo-client-test/1.0'); $requestFactory = new Psr17Factory(); $uriFactory = new Psr17Factory(); $requestBuilder = new RequestBuilder($requestFactory, $uriFactory, $config); $logger = new NullLogger(); //~ Client $client = new Client($httpClient, $logger, $requestBuilder); //~ Call endpoint and get Value Object with response data $status = $client->getStatus(); // Get status (VO\Status); echo "Server is $status->status\n"; echo "Number of characters online: $status->charactersOnline\n"; //~ Move a character $myClient = new MyClient($httpClient, $logger, $requestBuilder); $myClient->actionMove('character_name', new BodyDestination(1, 1)); //~ Crafting an item $myClient->actionCrafting('character_name', new BodyCrafting('wooden_staff', 1));
Contributing
See the CONTRIBUTING file.
Install / update project
You can install project with the following command:
make install
And update with the following command:
make update
NB: For the components, the composer.lock file is not committed.
Testing & CI (Continuous Integration)
Tests
You can run tests (with coverage) on your side with following command:
make tests
You can run tests (with coverage) on your side with following command:
make integration
For prettier output (but without coverage), you can use the following command:
make testdox # run tests without coverage reports but with prettified output
Code Style
You also can run code style check with following commands:
make phpcs
You also can run code style fixes with following commands:
make phpcsf
Static Analysis
To perform a static analyze of your code (with phpstan, lvl 9 at default), you can use the following command:
make analyze
Minimal supported version:
make php-min-compatibility
Maximal supported version:
make php-max-compatibility
CI Simulation
And the last "helper" commands, you can run before commit and push, is:
make ci
License
This project is licensed under the MIT License - see the LICENSE file for details
velkuns/artifactsmmo-client 适用场景与选型建议
velkuns/artifactsmmo-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 08 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 velkuns/artifactsmmo-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 velkuns/artifactsmmo-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 29
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-11