Part 1 | Part 2

Table of Contents


In the PHP landscape, perhaps no framework has made as daring of decisions and as innovative of choices as Laravel, the PHP ecosystem that has long not been afforded the spotlight offered readily to CMS ecosystems like Drupal and WordPress and the lower-level Symfony. Laravel has displayed some unconventional directions, including adopting Vue.js as its JavaScript framework of choice and eschewing some of the common features available in other web frameworks. Fortunately, with the rich ecosystem available in Laravel as well as a host of developer experience advantages, it's time to take a second look at Laravel's capabilities, especially for mission-critical sites in the enterprise that serve hundreds of thousands, and even millions, of users.

Laslo Horvath (Senior Laravel Developer at Tag1) joined Fabian Franz (Senior Technical Architect and Performance Lead at Tag1), Michael Meyers (Managing Director at Tag1), and me (Preston So, Editor in Chief at Tag1; Senior Director, Product Strategy at Oracle; and author of Decoupled Drupal in Practice) for a Tag1 Team Talks episode that explored a Tag1 project for a large enterprise website having millions of active members and thousands of local affiliate chapters. We talked at length about how leveraging Laravel led to unexpected benefits in developer experience. In this two-part blog series, we'll cover some of the most salient conclusions from our discussion and why you should consider Laravel for your next enterprise-grade website project.

A bit of background

Tag1 recently completed a substantial implementation for a large United States-based client that manages memberships for millions of people across the country. The organization is made up of over three thousand affiliate chapters that are managed by local groups, which in turn roll up into state and regional groups. As readers can imagine, such a massive organization inevitably requires complex workflows, and in this case, local affiliates could be managed by volunteers or individuals designated by the umbrella entity, thus obligating a system that could be used by a diverse range of users aiming to complete a diverse range of tasks.

Key project features

Some of the most important features included the ability to change personal information and update key data such as your residential address, in order for the organization to accept fees and dues and for the organization's members to track and receive the benefits they are promised through their dues. As such, one of the key considerations for this project was user experience, as Michael eloquently stated during our conversation: "Every click we can save them, every minute that we can bring back to the organization is something they can use to apply to other areas and functionality."

In addition, the need to merge data from the standpoint of a unified user interface was of paramount importance from the perspective of user experience. One requirement of the interface was that it support in-place editing to keep edits of data as efficient as possible. These edits, conducted in a single-page JavaScript application, would then be pushed to an application programming interface (API) in a back-end system that could be integrated with a variety of other services and internal systems that are continuously pushing and pulling data from one another.

Some of the major technical challenges confronted by this project included a limited technology team that was often unable to handle the large volume of requests from other functions in the organization. Thanks to a more robust, modernized implementation, this organization can now manage this architecture long-term. Tag1 worked with this client to train and mentor their resources and oversee their development work to ensure effective maintenance many years down the road. Laravel was chosen not only because of its ability to abstract much of the complexity behind the scenes for day-to-day needs but also due to the sheer amount of data that needed to be synthesized into a single interface.

Advantages of Laravel

According to Laslo, Laravel is an exceptionally well-positioned tool for architecting custom applications that traffic in highly complex logic. Internally, Laravel works well with Symfony and is well-structured in such a way that allows developers to focus on building in the necessary business logic itself rather than ancillary areas of the application. In addition, Laravel supports fast provisioning of new APIs, which in turn makes it a suitable choice for building single-page applications in JavaScript.

The Laravel developer experience

Besides its higher-level benefits, Laravel is also an excellent choice due to its lack of a steep learning curve, as opposed to Symfony or, more notoriously, Drupal. On our Tag1 Team Talks episode, Fabian mentions that Laravel's success is due to its emphasis on a great developer experience. For instance, features that are integral to web development frameworks like the availability of dependency injection containers is something that is more straightforward in the Laravel context.

Fabian goes further to describe one of the key examples of how Laravel makes the developer experience as simple as possible. Consider a scenario in which you need to set up an API that includes authentication. Not only is the provisioning of the API itself complex; so is the challenge of providing authentication and the need to provide an authentication token factory. In Laravel, however, an authenticated API with access tokens requires just one line to implement, and any integrated Vue.js front end can communicate with Laravel "like magic," to use Fabian's turn of phrase.

Leveraging Laravel for single-page applications

There's another reason why Laravel is so compelling for single-page JavaScript applications: its deep integration with Vue.js, as I teased in the previous paragraph. It is an understood law in web development that allowing all users to write directly to an underlying database is not a best practice. According to the rules of modern web development, as Fabian states, "you want your database to be specified on a schema but hide the database complexity behind way easier[-to-use] APIs.

Because single-page applications are API-based by default, as they are the primary means by which JavaScript applications like those implemented in Vue.js are able to communicate with back-end systems, Laravel is effective for dogfooding your APIs within well-integrated applications as well. In the future, other services such as an internal third-party system can acquire data from the same database merely by traversing the same APIs that are required to support the user interface.

Challenges of leveraging Laravel

Though Laravel has clear benefits when it comes to developer experience, it is not necessarily the best choice for a full-featured solution, as Fabian mentions during our Tag1 Team Talks episode. He stresses the fact that Laravel is "much more bare-bones than what we're used to from Drupal." For those coming from the Drupal universe, Laravel has an element akin to Drupal entities known as models which also serve as editable tables. In order to access information from other models, developers must define a relationship in Laravel that enables them to build a complex structure mirroring that relationship in the database and describe that same logic in an application. Therefore, developers needing to work with highly custom data models will find Laravel to be a breath of fresh air.

For this particular client, the Tag1 team needed to use Microsoft SQL Server due to project requirements, despite the unusual nature of leveraging PHP in conjunction with a Microsoft database product. Thanks to the existing data structures provided by Microsoft SQL Server, the team was able to use Eloquent, a Laravel object-relational mapping (ORM) library, to abstract a data model without altering the underlying database. This approach was required due to the substantial amount of legacy data present in existing databases. As Fabian noted during our conversation, for this particular client it was essential not only to migrate data to a more modern database system but also to design a database structure that would remain resilient for years to come.

Conclusion

For a mission-critical site like the one Tag1 built for an organization with millions of active members and hundreds of local affiliates, the need for a resilient and robust web framework suitable for both the back end and front end could not be more important. In this scenario, Tag1 opted to utilize Laravel, an open-source PHP framework that emphasizes efficient developer workflows, to serve this client with a website that would remain maintainable for years to come and a modern database that would underpin business needs across multiple decades. Despite the limited technology team and challenges around greater customization required in Laravel, the successes are clear in terms of an understandable developer experience for the customer as well as a modern architecture that leverages an API-first approach and modern JavaScript development in the form of Vue.js.

In this blog post, we covered some of the key issues in implementing large-scale Laravel, particularly for an organization with a bevy of requirements, a throng of users, and a variety of specific needs. We explored some of the ways in which Laravel enables a more favorable developer experience thanks to its API-based and extensible approaches, as well as its deep and rich integration with Vue.js. In the second installment in this two-part blog series, we turn to some of the back-end and front-end development challenges that characterized this project, particularly when it comes to avoiding reinvention of the wheel and working with Vue.js and Laravel, two sometimes highly different approaches to business logic on the web. In the process we will apply our learnings to the case study in question and dig deeper into how Tag1 enabled millions of users and hundreds of affiliates to migrate onto a more modern and robust architecture ready for anything the future may bring.

Special thanks to Jeremy Andrews, Fabian Franz, Laslo Horváth, and Michael Meyers for their feedback during the writing process.

Part 1 | Part 2


For all of our Laravel content, click here.


Photo by Pedro Lastra on Unsplash