marlemiesz/wp-sdk
最新稳定版本:v0.1
Composer 安装命令:
composer require marlemiesz/wp-sdk
包简介
The WP API SDK for PHP is a client library that makes it easy to interact with the WordPress REST API from a PHP application. This SDK provides an easy-to-use interface for sending HTTP requests and handling the responses, and also includes convenient methods for accessing common API endpoints and d
关键字:
README 文档
README
Require this package in your composer.json and update composer.
"marlemiesz/wp-sdk": "dev-master"
OR
composer require marlemiesz/wp-sdk: dev-master
Docs
Authentication
To use the SDK, you need to create an instance of the Wordpress class and pass it your credentials.
use Marlemiesz\SdkWordpress\Wordpress; $wp = new Wordpress('http://example.com', 'username', 'password');
Categories
Api Reference: https://developer.wordpress.org/rest-api/reference/categories/
Get all categories
$categories = $wp->getCategories();
Posts
Api Reference: https://developer.wordpress.org/rest-api/reference/posts/
Get all posts
$posts = $wp->getPosts();
Add new post
$post = $wp->addPost( 'Post title', 'Post content', \Marlemiesz\WpSDK\Enum\PostStatuses::PUBLISH, [1, 2, 3], )?->getFirstItem();
Update post
$post = $wp->updatePost( 1, 'Post title', 'Post content', \Marlemiesz\WpSDK\Enum\PostStatuses::PUBLISH, [1, 2, 3], )?->getFirstItem();
Delete post
$wp->deletePost(1);
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2023-02-08