Download the PHP package wp-kit/rest-kit without Composer
On this page you can find all versions of the php package wp-kit/rest-kit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package rest-kit
wp-kit/rest-kit
is a micro solution for using Wordpress as a Headless CMS.
Installation
Download Composer and install using this command
Working with Bedrock?
Firstly, install Bedrock, then;
When should you use wp-kit/rest-kit?
If you're looking for a framework to be able to build and manage custom Gutenberg blocks (both React style or with ACF Blocks) and want to manage how blocks looks and are styled in the editor and want to consume Gutenberg block data via Wordpress Rest API, and would like to easily register Post Types and Taxonomies and organise your code contextually within Controller and PostType/Taxonomy classes then this is a the perfect framework. Features include;
- Webpack configuration to easily create / edit and style React-style Gutenberg blocks for the editor
- Gutenberg Blocks are JSONified and send in WP REST API response for Posts (CPT) and Pages
- ACF Blocks are easily registered via config and managed via view files for the editor
- ServiceProvider Config
- PostType Registration
- Taxonomy Registration
- Invoke Controllers on Conditions
Just want to get Blocks in WP REST Response?
One of the key features on rest-kit is that it outputs JSON Blocks, including ACF Blocks, for Posts and Pages in the API response under a property gblocks
. This framework is great when you want to also add custom React-style blocks or register and manage ACF Blocks but if you don't need those features or feel rest-kit is too overkill for you, we have abstracted the JSON Blocks feature away into it's own plugin:
Recommended Plugins
We recommend the following plugins depending your use case:
Plugin Name | Explanation |
---|---|
WP Rest Filter | In the boilerplate code for wp-sapper-start, we have included examples of filtering by term and author slugs, and have implemented this based on using WP Rest Filter. We generally recommend this plugin when seeking to fetch posts and pages primarily based on term slugs. |
Yoast SEO | In the boilerplate code for wp-sapper-start, we have included examples of meta tags, and have implemented this based on using Yoast SEO and WP Rest Yoast Meta. We generally recommend this plugin in all cases to control tags within any framework you may be using. |
WP Rest Yoast Meta | In the boilerplate code for wp-sapper-start, we have included examples of meta tags, and have implemented this based on using Yoast SEO and WP Rest Yoast Meta. We generally recommend this plugin in all cases to control tags within any framework you may be using. |
WP Rest API V2 Menus | In the boilerplate code for wp-sapper-start, we have included examples of fetching menus, and have implemented this based on using the endpoints provided by WP Rest API V2 Menus |
Application Password | In the boilerplate code for wp-sapper-start, we have included examples of creating comments, form submissions and previewing draft post and pages; we have implemented this based on storing username and application password in a .env file which is read using server routes which sends a Basic authentication header to the API, this requires Application Password. We generally recommend this plugin when needing to write data back to the API or when needing to authenticate with Wordpress for any reason from your app. We recommend this over storing the raw password in .env or using WP oAuth Server which add more complexity than is neccessary due for a headless website. |
ACF to REST API | We generally recommend this plugin if you plan on using ACF in order to output field values within feild groups assigned to Posts and Pages, as oppose to Blocks. Any fields assigned to ACF Blocks are automatically pulled into the response when using rest-kit |
WP REST Cache | We generally recommend this plugin for all scenarios when using Wordpress as a headless CMS regardless of the framework you are using. |
Gists
Menu Endpoint
We have recently removed the Menu endpoint by default from the boilerplate code in favour of using WP Rest API V2 Menus. You can easily add this back:
Add Menu endpoint in wp-kit/rest-kit, if you don't want to use plugins/wp-rest-api-v2-menus
Adjusting Gutenberg JSON
We have recently pruned the transformation code right back so the schema of blocks received in the response is exactly the schema provided by parse_blocks()
. You can change and transform this however you wish:
Adjusting Gutenberg Block output in REST Response
Get Involved
Any help is appreciated. The project is open-source and we encourage you to participate. You can contribute to the project in multiple ways by:
- Reporting a bug issue
- Suggesting features
- Sending a pull request with code fix or feature
- Following the project on GitHub
- Sharing the project around your community
Requirements
Wordpress 5+
PHP 7.4+
Composer
Node
NPM
Security Vulnerabilities
If you discover a security vulnerability within wp-kit/rest-kit, please send an e-mail to [email protected] or raise an issue on this repo. All security vulnerabilities will be promptly addressed.
License
wp-kit/rest-kit is open-sourced software licensed under the MIT License.
All versions of rest-kit with dependencies
illuminate/http Version ^8.0
wp-kit/registry Version ^2.0
wp-kit/foundation Version ^2.0
filp/whoops Version ^2.7
wp-kit/invoker Version ^2.0.5
wp-kit/acf-integration Version ^2.0