INSIGHTS

WordPress as a Front-end Content Management System for Custom Laravel Applications

What if you could marry WordPress and Laravel? I decided to find out for myself

Mike McLaughlin

The Challenge

How do you develop a technically challenging, database driven web application that is highly scalable and accessible on the back end, but with easy to change and manage marketing pages on the front end? What if you could marry WordPress and Laravel?

Traditionally, a web application has been designed with webpages built into the web application so that there is very little difference between publicly served web pages and the areas accessed after a user is securely authenticated. This allows for straight forward deployment options and secures both the public and the private areas. However, this comes at a cost, it increases the development time of the public areas and requires skilled technical resources to initially develop the public areas and to make any ongoing changes (even simple changes). This leads to mistakes, complex interactions with content creators and developers, and delayed deployment of changes that could be important to the end user.

A better solution would be to use a commonly used content management system as the public web site area, and a framework like Laravel to develop the complex private areas that would encapsulate all the business logic, secure login process, database interactions and all other things that would require technical expertise to develop, test, and deploy, without affecting the public areas. Essentially why not have WordPress for Laravel?

Laravel is a framework that allows for developing large scale web-based applications using PHP and web server technology. This framework is very powerful and allows developers to create object-oriented solutions that involve moving data in an out of databases, along with formatting information in a way that takes advantage of many of the user interface design elements that are available on the modern web today. Encapsulating business logic and abstracting complex data models are just some of the problems that Laravel solves.

WordPress is the go-to content management system for website and blog development. It has many templates available along with an administrative backend that allows content developers to quickly create websites and add changing content to make their site more relevant. WordPress allows this to happen without the intervention of technical resources on a continuous basis.

The challenge is much harder than it seems. Laravel was not designed to integrate with any content management system. Many Laravel designed applications also take in to account scalability so that they can be deployed in an Amazon like environment behind load balancers. These complex system designs add to the difficulty. The hardest challenge however is the design of the Laravel routing system which makes it difficult to ensure that traffic for API, private areas and public areas all get to their correct destinations especially when you add the complexity of the WordPress taxonomy for dynamically created content into the mix. The routing becomes very difficult to understand and code for.

The Solution

Mixing WordPress and Laravel together requires knowledge of how WordPress works. WordPress requires installation in its own directory and requires database access. In order for the homepage and all publicly accessible pages to be displayed you need to put WordPress into the public directory. Doing this will overwrite the index.php Laravel needs to operate and you will never be able to successfully complete the installation ofWordPress. Likewise, putting WordPress into a subdirectory will prevent users form accessing WordPress as the homepage in the root directory. You should create a subdirectory for WordPress in the public folder and install WordPress here. You will update the WordPress site URL and home URL later to reflect this subdirectory. In order to complete the WordPress installation and allow it to be the home page for all future dynamic content new routes need to be created in the routes/web.php file of Laravel. The order of the entries in this file is important. This first entry redirects any traffic for the home page to WordPress. The last will handle all of the wordpress dynamic taxonomy that is not part of your Laravel application to wordpress. It is important to note that all of your Laravel application routes are between these two entries.

You can now complete the WordPress installation and database setup remembering that the site URL and home entries in the wp_options table need to be modified to reflect the subdirectory that WordPress was installed to. From here you can reference a common database or a local database depending on your needs. One of the more difficult aspects to this system is using a load balancer to terminate your SSL certificate. If you are doing this, you will need to add code to the wp-config.php file of WordPress. This will allow the https traffic through to WordPress correctly.

The Results

This technique of using WordPress as the front-end content management system to a Laravel web application has saved countless hours of frustration and programming in order to make publicly visible, mobile responsive pages. Using templates to create stunning web pages with dynamic content and allowing content to be added frequently, helps engage customers more, improves SEO performance, and saves development resource time so that they can improve web application features.

Everyday UX Design

UI/UX is an ever-evolving field and takes a lot of user testing, user research and versioning. Taking your everyday experiences and interactions into account will make your UX design top-notch. During the course of our day we interact with many user interfaces. Whether your checking out at the grocery store or dealing with an online transaction UX design is critical to each basic transaction. Unfortunately, many remember more of their bad user interface experiences rather than the ones that run smoothly. This is the very reason why good UX is critical and that’s why Trihelix Software does the research for you.

My “SuperHuman” app concept was recently featured on Springboard.com as an emerging concept to make your everyday tasks easier. The app is based on a concept of aggregating all of your most frequently used apps. “SuperHuman” app brings your VIP cards, gym memberships and payment processing into one interface. The app processes your most frequently used apps upfront during setup and calculates how much time is spent on each app. If there are apps on your phone that do similar tasks it notifies you. As a user you get to decide which app is working best. Instead of combing through your settings and deleting each app individually this app is the “Marie Kondo” app de-cluttering all your apps on the backend.

Although the “SuperHuman” app is just a concept it shows the strength of the UX Designer. As a UX Designer I have to think about personas, empathy mapping, user flows and user testing. Check out my latest feature on Springboard.com to learn more about the UX process: Springboard.com Student Success (Nicole Hazelett).

Laravel framework for web platform development.

Laravel framework is an open source framework for web development that greatly enhances the productivity of software development shops.  In the classic software development project, the project blocks are defined, along with all the interactions with those blocks. There are different aspects to the project that are relevant to every block (i.e. security, multi-tenancy, database access, etc.).  Laravel allows architects and developers to focus on the specifics of the individual blocks and how they are connected, knowing that the important aspects of the project are handled correctly by the framework.

Laravel being an open source framework, allows developers to use and instantiate the Laravel classes directly, or override them if bugs are found or improvements need to be made.  Are you working with message queues, or creating an administrative dashboard, tools for this are available in Laravel. Do you need your system to email people at different points in the process, Laravel makes it easy to use a third party email services or your own.  Need to create a special task that can be re-used all over your site, Laravel gives you the tools you need to create modern, maintainable, web based applications.

Laravel’s approach to its framework allows for easy integration into your continuous integration and development stack, so iterations and improvements are more agile.  Laravel has created an ecosystem of great extensible code, and a worldwide list of developers that are constantly improving the way you create and build better web based applications.

Prototype or MVP

A Prototype is essentially a proof of concept, it demonstrates a product or process or an idea. It can be functional but doesn’t have to be, it can even be a sketch or a CAD drawing. It is not intended for sale. It is used to understand or determine viability of product, process, price, and cost, and/or to raise funds for future development.

An MVP (Minimally Viable Product) must be functional and sellable. It must work and include enough functionality for a business or consumer to make an informed decision to purchase it based on function or price or both. An MVP must be supported once introduced along with continuous improvement of product/process/price/marketing.

PrototypeMVP
PurposeTest proof of concept/feasibilityMaximize return for the least cost/effort
FocusPresentation to Stakeholders, or Investors, proof of concept and IdeaDeployment to production for sale, product features and functionality
FeaturesOnly those needed for demonstrationBasic and Functional
AudienceDecision Makers and/or InvestorsCustomers and/or Investors
ValueDemonstrates Promised ValueDelivers Tangible Initial Value
Business CaseBusiness Case and Product unproven, insufficient funds, risks unknownBusiness Case and product are sound, sufficient funding, minimal risks
RevenueNot for SaleSold to Early Adopters

Contact TriHelix Software to Discuss the Details of Your Project