endeavour/groeigids-api-client
Composer 安装命令:
composer require endeavour/groeigids-api-client
包简介
Api client for importing GroeiGids articles
README 文档
README
The Groeigids API Client is a PHP library designed to interact with the Elkander Groeigids API, making it easy to fetch and manage articles and themes. Swagger documentation of the API can be found here.
Features
- Fetch articles and themes from the Groeigids API
- JSON schema validation for API responses
- Support for query parameters and sorting
- Custom exceptions for error handling
Requirements
- PHP 8.1+
- Composer
- A valid API key for the Groeigids API
- A PSR-18 compatible HTTP client
- A PSR-17 compatible HTTP factory implementation
Installation
To install the Groeigids API Client, use Composer:
composer require endeavour/groeigids-api-client
Configuration
To run integration tests, a .env file should be created in the root of the project with the following content:
GROEIGIDS_API_KEY=your-api-key-here
Usage
To use the Groeigids API Client, create an instance of the GroeigidsApiClient class:
use Endeavour\GroeigidsApiClient\Infrastructure\HttpClient\GroeigidsClient; $client = new GroeigidsClient( ClientInterface, RequestFactoryInterface, new ResponseDataBuilder(), new ResponseValidator(new Opis\Validator()), getenv('GROEIGIDS_API_KEY') );
Now fetching articles and themes is as simple as calling the fetchArticles and fetchThemeArticles methods:
$articles = $client->fetchArticles(); $themes = $client->fetchThemeArticles();
The fetchArticles and fetchThemeArticles methods accept an optional array of query parameters:
$articles = $client->fetchArticles(page: 1, size: 10); $themes = $client->fetchThemeArticles(page: 2, size: 50);
The fetchArticles and fetchThemeArticles methods also accept an optional TypedArray object containing sorting parameters:
$sortParameters = new TypedArray(SortParameter::class, [ new SortParameter('title', 'asc'), new SortParameter('order', 'desc') ]); $articles = $client->fetchArticles(sort: $sortParameters);
Other functions are available to fetch articles by ID, by breadcrumb or those modified after a certain date:
$articleById = $client->fetchArticle(1); $articleByBreadcrumb = $client->fetchArticleByBreadcrumb('article-breadcrumb'); $articlesAfterDate = $client->fetchModfifiedArticlesAfterDate(new DateTime('2020-01-01'))
Testing
To run the unit tests, use PHPUnit (make sure a .env file is present in the root of the project):
make up
make test
Contributing
Contributions are welcome!
Licence
This project is licensed under the MIT License.
endeavour/groeigids-api-client 适用场景与选型建议
endeavour/groeigids-api-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.33k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 05 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 endeavour/groeigids-api-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 endeavour/groeigids-api-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-17