kazakevic/strapi-wrapper
最新稳定版本:2.0.1
Composer 安装命令:
composer require kazakevic/strapi-wrapper
包简介
wrapper for Strapi headless CMS
README 文档
README
⚙️ Install
composer require kazakevic/strapi-wrapper
⚙️ Usage
- Setup Client
- You can use any HTTP client that implements
Psr\Http\Client\ClientInterface
- You can use any HTTP client that implements
$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
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-04