Those who are familiar with WordPress have probably heard of this new editor called Gutenberg. If you have no idea what I am talking about, don’t worry.
Gutenberg is the latest user friendly editor that everyone trying to integrate. It gives option to create custom blocks and various types of elements which make your content area more decent and professional.
This is where our Laravel plugin, Laraberg, comes in. It takes all the configuration you would have to do to get GutenbergJS running in your Laravel application, and puts it into an easy to install package. After installing you’re free to use to Gutenberg editor in any way you see fit, from entire pages for your website to small sections on your webshop’s product detail page.
The goal for Laraberg is to give developers the ability to add the Gutenberg editor to any page they like in a way that is as easy as possible, but at the same time it has to prove enough options to tailor the editor so it can fit into any Laravel project out there. To make this possible there were a few problems to solve.
Since GutenbergJS is ‘only’ a standalone version of Gutenberg, it does not implement any of the WordPress functionality that the editor needs. This means that Laraberg has to come with its own implementations for some of those.
Some of Gutenberg’s blocks are dynamic, those are the reusable blocks, and the embed blocks. For those blocks Laraberg provides API endpoints that retrieve the necessary data to render those blocks inside the editor. And, in the case of reusable blocks, Laraberg also provides the endpoints to create, update and delete those blocks.
A lot of data that Gutenberg requests from WordPress is irrelevant for Laraberg, and because of that we can send standard mock data whenever the editor requests this information. This includes requests like the theme’s capabilities, the available taxonomies and the different post types.
When a page made with Gutenberg gets submitted, the resulting content is not always fully functional HTML. When a page has any dynamic blocks inside of it, there is some processing that has to be done before the content will show correctly.
Besides those points there were some more problems to solve, like replacing the WordPress media library, making Gutenberg’s content easily accessible and providing configuration options for the API endpoints.
Final Words :
If you would like to give Laraberg a try, the release is available on Github. If you want to Develop your own website in Laravel Framework, feel free to Contact us !!