DEV Community

Cover image for A 2024 Retrospective: My Unexpected Astro & Laravel Love Affair
Jon Brookes
Jon Brookes

Posted on

A 2024 Retrospective: My Unexpected Astro & Laravel Love Affair

This is a submission for the 2025 New Year Writing challenge: Retro’ing and Debugging 2024.

Marking the first days and months of 2024 I started a site to host articles and blogs about a variety of my interestes such as system security and prompting AIs under what I like to call uploadz and missivz.

I am using Astro having migrated from Gatsby in years previous. Astro is arguably faster to compile static sites and has a simpler, cleaner, in my view, way of creating simple component based web pages. It has the capability of embedding 'islands' of react, svelte, even plain Javascript and far more without having to go full on SPA if you don't want to. This was too tempting not to take a look and quite frankly I got hooked. Whilst I don't use a fraction of what Astro has to offer it has become a go-to for me for not just static sites but also to create POCs, quick Demos and more. It also has become the basis of a lightweight content management system I am developing and have implemented this year for clients and a non-profit. The CMS I refer to uses a back-end written in Laravel.

Laravel version 11 landed earlier this year and I started migrating from 10 of the year previous. This being my second year of using Laravel as a primary web framework for back-end service to replace that of Firebase and my own containers, functions etc hosted elsewhere. I will no doubt work towards using services written in Go that I develop to augment Laravel Applications however Laravel seems to offer so much out of the box I am spoilt for choice and find myself far more productive than ever before.

The thing that got me onto Laravel was not a part of its core infrastructure per se rather, a 3rd party called Filament which I was astonished at how quickly I could create admin dashboards in lightning speed when compared to other frameworks I have previously encountered. I found myself reverting to PHP from JavaScript and Typescript but in the opinionated batteries included framework of Laravel. All this is after abandoning Perl years ago in preference for WordPress but always wanting for something I could write solid back end systems with. Laravel has it all.

I thought I would lose the time and effort now over years to learn and implement React and Vue apps, MeteorJS even in the early days but of all that time I thought, to abandon it now in favour of Laravel, what a waste of effort to date ?

But I was wrong, as Laravel does not seek to replace but acts as an enabler in this regard.

As frameworks go it has a firm grounding in MVC something I've been familiar with for and happy with for years so that pattern is ticked but that's not what I think is its current strength and many Javscript / Typescript based frameworks have this already. It can completely replace Javascript if your happy to write in PHP, which I am having grown up alongside it over the years and writing too much Perl back in the day. The $ before variables is something familiar from the 90s for me and still is. The combination of AlpineJS in the background and Livewire lets me write 'blade' like templates that render active JavaScript on the front end and even have SPA like behaviour without writing a line of Javascript. It feels or looks a bit like XHTML in this regard perhaps.

But if I still want to write a React App and keep all that knowledge hard earnt, blood sweat and toil I can as Laravel can do that also with a 'glue' code called Inertia of which I have not played with nearly enough in 2024 and will no doubt explore more in the coming year. Where as I would have reached for Firebase or similar to give me a solid back-end for my front end apps in the React space I can now lean heavily on Inertia to do the heavy lifting for me to integrate with Laravel on the back end, removing lock in to BaaS services and allowing me to 'take back control' of my data, truly owning it on my own cloud VM, swarm, k8s cluster or whatever I like.

It is possible to integrate Laravel with NextJS if you do not want to replace it and writing APIs in Laravel is also a breeze. So integrating with anything that can talk REST is a goer.

Mentioning the word 'breeze', there are starter kits including Breeze and Jetstream that give us fully functional authentication out of the box and ready to use with plain Laravel, APIs, Livewire or Inertia apps although I believe Vue is the preferred front end framework for the latter. But I like Vue also and they gave us Vite, thank you Evan You. I really like using jetstream of the 2 starter kits as it even gives us 2FA. Bliss.

Oh, and I did say MVC but there is Laravel's eloquent, an ORM that I actually like using, not to mention Artisan that pins Laravel together with a CLI to create Models, Views, Controllers with migrations ready to go. No more messing round building migrations into my apps as I found myself doing before with other frameworks, it's all just there in Laravel.

I've stopped sweating the small stuff and have been able to get on with writing my apps.

I hope for this to continue as I grow into using Laravel with greater competence and confidence in 2025 and very much hope you will too.

Top comments (4)

Collapse
 
oitoit profile image
Basebasket

Great post and nicely written. I have been playing with Laravel for some time now as well. Hope you do excel in 2025 and beyond.

If interested, please check Laravel and Livewire based open source ERP I have been working on some time now.

github.com/oitcode/samarium

Planning to do some promotion of this project in 2025.

All the best for your 2025.

Collapse
 
marshyon profile image
Jon Brookes

Thanks, I will keep an eye out for your posts re samarium.

I see your approaching packaging this as a single app like I have. I had wondered to myself about using a package for all of the app or in parts by sub components or 'features'.

Is that something you have considered ?

Collapse
 
oitoit profile image
Basebasket

Thanks for your reply.

Yes I have though of making it as a Laravel package. Lets see how I will go about it.

Thread Thread
 
marshyon profile image
Jon Brookes

cool, ,I'm very interested in this sort of thing. I feels like the way you extend WordPress only with a lot more polish that Laravel brings. I just like Laravel's approach more to packages and extending apps in this way.