DEV Community

loading...
Cover image for Why, when, and how to develop WordPress with Laravel features, live examples.

Why, when, and how to develop WordPress with Laravel features, live examples.

Soso Gvritishvili
https://www.linkedin.com/in/ioseb-gvritishvili/
・4 min read

Whatever you think about my preferences, I will demonstrate the sites made with Laravel and WordPress. I love both technologies, they are perfect, just need to know when and what to use.

Why, when, and how to develop WordPress with Laravel features, live examples.

There are two types of people (programmers and non-programmers included). Some use WordPress with installation templates and minimal coding, while others, for example, Laravel or Symfony developers didn’t even read the documentation of WordPress. What unites them? Ignorance of WordPress functionality and simplicity.

Let’s imagine that we have to write a simple or Medium difficulty website, which needs an attached big admin panel with a lot of routines while the development process. Many tables, cruds, and fields per unique page (template), at the same time, no need in functionality, calculations, or other hard coding stuff. By client requirements, it is clear that the theme must be unique and created from scratch. WordPress theme installers (Person who thinks that WordPress development is just theme installation and configuration) who are changing colors and fonts cant handle such issues(don’t have PHP and WordPress skills ), Laravel, or other framework developers can build unique designs, but they need a lot of time and also won’t learn especially interesting by doing a routine, this means that their time is wasted unproductive and inappropriate. For our happiness, WordPress gives interesting low database and model work stuff, very easy admin panel development tools, like ACF(custom fields plugin), and development time reduces several times.

About WordPress

You can argue, WordPress theme structure is not developer-friendly, no MVC architecture structure, no OOP, but it’s only when first time sees WordPress (WordPress’s use event-driven (hook) architecture system) themes or plugins, you can choose any paradigm, object-oriented, procedural or functional same use any structure you want and like. WordPress is very tolerant of the developer’s whims. Whole software companies or independent programmers already created very good and useful starter themes and projects, which can be used by anyone.

Mostly, I prefer using roots products, starter project - Bedrock and theme — Sage9, roots also offer WordPress server — Trellis. Sage is the most stable theme(bug fixing, updates), with a big community and quality team. Sage has the ability to use dependency managers like composer, restructured theme files, dry templates, image optimization, webpack with live reloading, SASS, separated controller, and View with comfortable ACF registration and e.t.c. There is everything for faster, cleaner, and modern developer workflow.

Sage controllerSage controller

Sage viewSage view

There are also very powerful and minimalistic starter themes. For more professional and complex website is wordplate - composer, laravel mix, custom SMTP, security, debugging, simple environment and e.t.c. makes WordPress workflow more professional and comfortable for all PHP developers.

underscores is also a very old and popular starter, but I don’t like it, because can’t find enough features, of course, it doesn’t mean that this theme is bad, I just don’t like it but a lot of experienced WordPress developers recommended it. So u can check and choose what you like. If you don’t need listed above themes, research on google and I’m sure you will find what you are looking for.

And don't forget, before u start to develop with starter themes, try to build simple themes from scratch to understand WordPress structure, theme anatomy, pages, single posts, plugins, widgets, templates, functions, hooks, Rest API, Ajax e.t.c. and most important always follow WordPress Codex.

About Laravel and WordPress

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. Use WordPress as admin panel and data manipulation, but code controllers, views with Laravel. Also with composer u can easily change it to other PHP Framework. Simple configuration, fastest code, and ability to write complex web applications, make Corcel one of the most interesting PHP Hybrid ever created.

About my projects

Ok, let’s move on to the next stage. Almost one and a half years ago, the project manager had shown me a new project, with more than 30 unique structure pages (templates) with a lot of content and fields. This was a real routine, functionality was low only some cron jobs, third party services, simple filters, and 4–5 forms which were solved with Vue.js and WordPress REST API, in Laravel, it would be the same. I decided to create it with Sage 9 and took this result. WordPress development was very fast, which was very important because the client wanted to get the result as fast as possible. There was nothing that u can’t make with WordPress and necessity in Laravel or another PHP framework. About security… with custom plugins and regular updates risk of malware and viruses are minimal, also no user registration.

For example, likanimw took me twice as long than to finish much bigger credobank

I saw Corcel in the real project at pdp where I just made debugging, I really recommended it.

Conclusion

WordPress is very easy to learn for beginners and makes life easier for experienced PHP developers. Even complex websites can bed builder with WordPress I just write from my experience and hope it would help you. Each project needs an exclusive approach with Cons and Pros and only after making a decision about which technology to use. Not very smart to use Ferrari on the farm.

P.S. Sometimes it is Laravel, sometimes WordPress and sometimes tasks required something else.

P.P.S. Sorry for my bad English :)

Discussion (0)