承接 mbvienasbaitas/strapi-php-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mbvienasbaitas/strapi-php-client

最新稳定版本:1.0.0

Composer 安装命令:

composer require mbvienasbaitas/strapi-php-client

包简介

PHP Client wrapper for Strapi API.

README 文档

README

Latest Version on Packagist Test Status Total Downloads

Installation

To get started, simply require the project using Composer.
You will also need to install packages that "provide" psr/http-client-implementation and psr/http-factory-implementation.
A list with compatible HTTP clients and client adapters can be found at php-http.org.

If you don't know which HTTP client to use, we recommend using Guzzle 7:

composer require mbvienasbaitas/strapi-php-client guzzlehttp/guzzle http-interop/http-factory-guzzle:^1.0

Usage

use MBVienasBaitas\Strapi\Client\Client;
use MBVienasBaitas\Strapi\Client\Contracts\Requests\Collection\IndexRequest;
use MBVienasBaitas\Strapi\Client\Contracts\Requests\Options\OptionLocale;
use MBVienasBaitas\Strapi\Client\Contracts\Requests\Options\OptionSortAsc;

$client = new Client('{url}', '{token}');

$request = IndexRequest::make(
    new OptionLocale('en'),
    new OptionSortAsc('title'),
);

$endpoint = $client->collection('articles');

$response = $endpoint->index($request);

More usage examples can be found in examples folder.

Available request options

Each request can accept multiple options. Here is a list of all available options.

Option Description
OptionFields Defines which fields to load.
OptionFilters Applies specified filters.
OptionId Sets active resource ID.
OptionJsonBody Ads application/json body from a given array.
OptionLocale Sets resource locale.
OptionPaginationOffset Offset based pagination.
OptionPaginationPaged Page based pagination.
OptionPopulateDeep Sets populate option, requires strapi-plugin-populate-deep plugin to be installed in strapi build.
OptionPopulateNested Defines which relations to load.
OptionPopulateWildcard Loads all first level relations.
OptionPublicationStateLive Set publication state to live.
OptionPublicationStatePreview Set publication state to preview.
OptionSort Define sorting options.
OptionSortAsc Set single field sort in ascending order.
OptionSortDesc Set single field sort in descending order.
OptionStreamBody Set custom stream body, mainly used for media uploads.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

This package structure was inspired by meilisearch-php package.

Alternatives

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 2.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-21