Perry Rylance

Personal & Professional blog

Laravel & WordPress plugin boilerplate

I’ve been following this article today on how to get Laravel setup in the context of a WordPress plugin.

The WordPress plugin is a REST cache which is based on software I’ve already written the core of, I wanted to use sending this plugin out into the wild as an opportunity to learn how to work with forms and validation in Laravel, and will also be hooking into the REST API via WordPress / Eloquent adapter.

This article looks great for beginners, and shows how to get setup with Composer and WordPress, however I’ll be opting not to use this, for two main reasons:

  • The boilerplate WordPress plugin follows WordPress’ naming conventions, I’ve always used the same style as Laravel, it’s much more standardised.
  • The article only really covers how to use Composer to install a couple of components of Laravel, rather than covering a full blown installation.

I’ve been reading up on Corcel, I’ll also be learning how to use Blade Templates to get the plugins menus setup and validating properly.

Here’s my very first Blade template, running on Laravel, through the WordPress admin UI

For anyone wishing to re-use my WordPress boilerplate plugin, please see packagist. You can check out the GitHub repo for this project for a brief overview of the methods available.