定制 kazakevic/strapi-wrapper 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

kazakevic/strapi-wrapper

最新稳定版本:2.0.1

Composer 安装命令:

composer require kazakevic/strapi-wrapper

包简介

wrapper for Strapi headless CMS

README 文档

README

Latest Stable Version Total Downloads License PHP Version Require

⚙️ Install
composer require kazakevic/strapi-wrapper
⚙️ Usage
  • Setup Client
    • You can use any HTTP client that implements Psr\Http\Client\ClientInterface
$httpClient = new Client(); //Guzzle http client, but can be any suitable

$strapiClient = new StrapiClient(
$httpClient,
'token',
'http://localhost:1338'
);
  • getItems
$response = $strapiClient->getItems(
    'item-identifier',
    new PageFilter(100),
    new SortFilter('id', SortOrder::DESC)
);
  • getItemById
$jsonData = $strapiClient->getItemById('seo-pages', 534546)
  • getItemsBy
    $response = $strapiClient->getItemsBy(
        'item-identifier',
        'fieldName',
        'fieldValue',
        new PageFilter(100),
        new SortFilter('id', SortOrder::DESC)
    );
  • createItem
$jsonData = $strapiClient->createItem('topics', [

'data' => [
    'Title' => 'Test Title',
    'Slug' => 'test-slug',
    'seoTitle' => 'test title',
    'seoDescription' => 'test description',
    'tags' => [1, 2, 2],
    'videoCount' => 10
]
]);
  • updateItem
$jsonData = $strapiClient->updateItem('topics', 1, [

'data' => [
    'Title' => 'Test Title',
    'Slug' => 'test-slug',
    'seoTitle' => 'test title',
    'seoDescription' => 'test description',
    'tags' => [1, 2, 2],
    'videoCount' => 10
]
]);
⚙️ Tests
./vendor/bin/phpunit tests

统计信息

  • 总下载量: 9.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-11-04