I find myself relying more and more on a combination of WordPress and the Laravel framework. WordPress is without a doubt the dominant player for website creation today. There are very few use cases where building a site completely from scratch is preferable. It takes much longer and is much harder to keep secure when you build from scratch.
But just because WordPress is an excellent hammer, not all problem sets are nails waiting to be driven home.
I’ve settled into a consistent and easily repeatable architectural pattern solving a number of complex needs of my clients without introducing increased complexity in WordPress.
For example, I currently have a client completely redoing their web presence. I set up a WordPress site for them using Nginx and MySql running on Ubuntu linux servers. However, part of their current web presence allows users to search their proprietary Microsoft SQLServer databases. Instead of writing a complex plugin in WordPress to search these databases and present the data I wrote a simple plugin providing a simple short-code I placed on a page and they styled to their liking. This short-code simply presents a page from a Laravel based api site.
Security is enhanced because the Laravel based api will only accept requests based on secure tokens and only from the servers hosting the WordPress front end. In short, the API isn’t published nor exposed to the internet – meaning there is one less thing to worry about.
Since WordPress provides easy ways to pull the resulting HMTL from a remote site, in this case the Laravel based api site, and embedding it in a page the user experience is seamless. On the Laravel side Vue.Js is used extensively to provide an interactive experience and the client loves it. It is impossible to tell the search screens and resulting views are coming from outside their WordPress site. They get the benefit of styling the page to suit their needs and even if those needs change any style changes will be applied to the api supported screens and views automatically.
Since multiple databases and even multiple database engine support is built into the core of Laravel, I’m able to deliver a solution exactly meeting their needs with a very lightweight WordPress plugin. It would be possible to do this completely within WordPress of course. But it would be much more complex and very difficult to maintain. WordPress doesn’t support multiple concurrent databases well nor multiple database engines at all. It can be done, but there are better ways. I wouldn’t consider writing a WordPress replacement in Laravel because it would be a waste of time and energy. And I wouldn’t try to use WordPress to pull information from multiple concurrent databases for the same reason.As a policy I don’t use real customer sites as examples. But this is unique enough I will probably mock up something similar to illustrate what is happening and how it was done.