Laravel Temptations

I need to modernize an old PHP web-app. I am facing down many hours of sifting through old messy code (written by me over many years) to figure out the essence and transform it into something more robust.

This is going to be painful, and I’m looking for anything that can help ease the burden.

One such helpful thing that comes up over and over in modern PHP chatter is Laravel.

Laravel in Context

Laravel is a modern PHP framework. By modern I mean it was first written in 2011. For reference PHP first appeared in 1995! PHP is an old language, but it’s still evolving for the better, which I find kind of endearing.

I started with PHP 5 some thirteen years ago, and built everything without a framework. My code suffered from multiple personality disorder as I tried different approaches to solve the same problem.

Now I need to put the whole thing into a blender, make a slurry of it and 3D-print a beauty of an application.

Using Laravel would represent a deep transformation not just of code but of attitude compared to when I started.

Laravel Attraction

I will need to rewrite my admin and backend code to accommodate new features. I’m really not looking forward to this. Is there a way to avoid doing that? Laravel Nova caught my attention. It’s a ready-baked admin panel, apparently, and if it’s half as good as it sounds, I’m in.

Nova would cost me a couple hundred bucks, but that’s peanuts compared to the pain of doing this myself.

That’s part of the attraction to Laravel: there are a bunch of these “add-ons”, some free some paid, and some as a service that I might leverage to remove some of my workload.

Other add-ons I find interesting (all are linked from Laravel’s home page):

  • Echo for real-time events
  • Cashier for subscription billing (although it’s for Stripe, which I am not using. It looks like they had Braintree support in 5.8?)
  • Passport for OAuth2
  • Scout for full-text search

I know many other frameworks offer similar solutions in various forms, but it’s comforting to see a neatly put together set of tools and services designed to make you more productive.

If Nova didn’t work out for me I could also use Backpack, but I like the idea of getting add-ons from the developer of the framework, it gives me hope that the add-on is seamlessly integrated with the main framework.

Laravel Concerns

I need to do more in-depth research on what it’s like to write an entire application using this framework. Like what it’s really like. Not a “Hello-World” type thing.

In fact I’ll probably have to code an example app just to get the feel of it. And you know what that app is going to be? My admin panel (or the start of it at least). Yup, you know it. This is how I am going to slip into this framework.

But seriously, I do have some concerns. My view of frameworks in general is that they make a lot of standard stuff very easy, but as soon as you get into an edge case you have to work harder to do what you need.

Another concern is breaking changes. One sweet advantage of “rolling your own” anything, is that you don’t change it if you don’t need to. Frameworks, libraries, all other code written to be reused by many others change a lot over time. There is always pressure to do things better, to stay relevant, to sell the latest add-on. The result is unwanted migrations that can lead to breakage and a lot of work for no real reason.

To Be Continued

If you’ve had experience with Laravel I’d like to hear your impressions.

If I go further with the framework I’ll let you know how it goes right here.

This was day 14 of the #100DaysToOffload challenge.

Olivier Forget

Los Angeles, USA
RSS Email Mastodon

Aerospace Engineer turned sofware developer and bootstrappin' entrepreneur.