Laravel & WordPress Integration

Laravel & WordPress Integration

Routing and Controller: In general, a back-end web application has one primary responsibility: to read each request and create a response depending on the content of the request. The controller is a class responsible for transforming the request to the response by calling application methods, while the router is a mechanism that helps you to detect which controller class and method you should execute for a particular request.

In the real-life applications, you shouldn’t call ORM from the controller. Instead, you should call a service that will try to find the post or throw HTTP 404 Exception.

Dependency Injection

Applications have a lot of different services and components, with various interdependencies. You need to store all the information about the created objects and their dependencies somehow.

Here comes our next component - Service Container. It is a PHP object that creates requested services and stores information about the created objects and their dependencies.

Great comparasion article by comparing modules both in Symfony and Laravel.

Integrating Laravel and WordPress

Create a Laravel or any PHP application, but use data directly from a WordPress database: corcel/corcel Example how to create separate Laravel app that will transfer Google Docs to Wordpress using WP’s JSON Rest API.

Writing plugin with Laravel

Why, when, and how to develop WordPress with Laravel features

Here is the most interesting part of the article, Laravel, and WordPress hybrid. If you are Laravel fan, can’t imagine yourself coding in other frameworks, and have complex applications with a lot of content, Corcel is what u need for happiness.

WordPress MVC is WP framework for custom Themes and Plugins development, but not Laravel out of the box.

WP Emerge Starter Plugin from repo htmlburger/wpemerge-plugin is by amazing author.

This should be my solution: Acorn | roots/acorn: Laravel components for WordPress plugins and themes but is poorly documented.

Whole WordPress Boilerplates

Visit another note for more info


date 22. Jun 2022 | modified 24. Jun 2022
filename: Wordpress » Laravel Integration