承接 angelxmoreno/wprestclient 相关项目开发

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

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

angelxmoreno/wprestclient

最新稳定版本:v1.2.1

Composer 安装命令:

composer require angelxmoreno/wprestclient

包简介

WPRestClient is a PHP library for seamless WordPress site interaction via the RESTful API

README 文档

README

Codacy Badge codecov GitHub license Open Source? Yes! PHP Version 7.4+ Maintenance

WPRestClient Logo

a PHP WordPress API Client

WPRestClient is a PHP library for seamless interaction with WordPress sites via the WordPress RESTful API, simplifying authentication, data retrieval, and content management tasks

Features

  • Connect to WordPress sites and authenticate using REST API authentication methods.
  • Retrieve posts, pages, custom post types, categories, tags and other WordPress entities.
  • Create, update and delete posts and pages.
  • Perform advanced queries and filter responses using the power of the WordPress RESTful API.
  • Use the APIClient for low level calls
  • Use Repositories and gain WordPress entity objects
  • Configurable API Prefix
  • Create custom entities or extend the existing ones
  • Create custom repositories for any endpoint

Requirements

PHP 7.4+

Installation

You can install WPRestClient via Composer. Run the following command in your project directory:

composer require angelxmoreno/wprestclient

Usage

  1. Create a new instance of the WPRestClient:

    use WPRestClient\Core\ApiClient;
    
    $client = new ApiClient('https://example.com');
  2. Retrieve a raw array of posts via the client:

    $posts = $client->sendRequest('get','/posts');
    foreach ($posts as $post) {
        echo $post['title']['rendered'];
    }
  3. Retrieve an array PostEntity objects via the PostsRepository:

    use WPRestClient\Repository\PostsRepositor;
    
    PostsRepository::setApiClient($client);
    $posts = PostsRepository::fetch();
    foreach ($posts as $post) {
       echo $post->getTitle();
    }
  4. Create a new Page via the PagesRepository using the RepositoryRegistry: By creating an instance of RepositoryRegistry, you have access to all the registered repositories with the ApiClient already set.

    use WPRestClient\Repository\PagesRepository;
    use WPRestClient\Core\RepositoryRegistry;
    use WPRestClient\Entity\PageEntity;
    
    $registry = new RepositoryRegistry($client);
    $page = new PageEntity(['title' => 'A New Page']);
    $registry->pages()->create($page);
  5. Delete a post via the PostsRepository using the RepositoryRegistry:

    use WPRestClient\Repository\PagesRepository;
    use WPRestClient\Core\RepositoryRegistry;
    use WPRestClient\Entity\PageEntity;
    
    $registry = new RepositoryRegistry($client);
    $post = $registry->posts()->get(123);
    $registry->posts()->delete($post);

For more detailed usage examples and available methods, please refer to the documentation.

Contribution

Contributions are welcome! If you find a bug, have suggestions for improvements, or would like to add new features, please submit an issue or a pull request. Make sure to follow our contribution guidelines

License

WPRestClient is open-source software licensed under the MIT license

Contact

For any questions or inquiries, please contact WPRestClient@gmail.com

Support

For bugs and feature requests, please use the issues section of this repository.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固