laravel

All my posts about laravel.

A package that adds resource links to your Laravel API resources original

by Freek Van der Herten – 3 minute read

At Spatie we have several projects where the UI is rendered using JavaScript (we're big fans of Inertia). The backend and routes are defined in the Laravel app. The backend sends information to the frontend using API resources.

We often add the available routes the frontend can use as links property on the resource. To avoid having to add all routes manually, my colleague Ruben released a package, called laravel-resource-links that can automatically add resource links to the API resource.

In this post, I'd like to introduce the package to you.

Read more

Join 9,500+ smart developers

Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.

No spam. Unsubscribe anytime. You can also follow me on X.

Live-Updating Status Page With Livewire

calebporzio.com

Recently status pages were added to Oh Dear!. My colleague Sebastian took care of the live updates with a few lines of JavasScript.

In a new video on his blog Livewire creator Caleb Porzio, shows how can create the same behaviour with Livewire (and without having to write JavaScript). Impressive stuff!

This sort of thing is right up my alley, but I couldn't help but think how easy it would be in Livewire. Here's is the same functionality implemented with Livewire, in three or four little code additions. No JS!

Read more [calebporzio.com]

Track successful email deliveries, clicks and opens in your Laravel PHP application with Mailgun

ninjaparade.ca

Yaz Jallad explains how you use Mailgun's webhooks to determine click and open rates of mails.

While building ContestKit there was a feature I wanted to allow users to know if the emails that were sent to the winners were delivered successfully. Thankfully this feature is relatively easy to add because of Mailgun's amazing API. Let's create a new Laravel application and get started.

Read more [ninjaparade.ca]

Event store optimizations in laravel-event-sourcing original

by Freek Van der Herten – 5 minute read

About a year ago, we released laravel-event-projector. It focused on adding projectors, an important concept in event sourcing, to Laravel.

After the release of the package, we continually kept improving it. We added aggregates, a way to test those, a brand new section in the our documentation that explains event sourcing from scratch, and DX improvements all across the board.

We now feel confident that the package is a good starting point for getting started with event sourcing in Laravel. That's why we're renaming the package to laravel-event-sourcing.

Read more

An alternative way to organize the Laravel directory structure

stefanbauer.me

I don't necessarly agree with every detail in this post, but it's very interesting to see how others structure larger projects.

In this article, I would like to show you an alternative way to organize your Laravel directory structure. I think the default structure is fine for the most projects. But when it comes down to larger projects I was looking for a different structure.

Read more [stefanbauer.me]

How we used Caddy and Laravel's subdomain routing to serve our status pages

ohdear.app

My buddy Mattias explains how you can use Laravel and Caddy to handle https traffic to dynamic subdomains.

We recently launched our new Status Page feature. Under the hood, it's using the Caddy proxy server and Laravel's subdomain routing to serve the right status page on the right domain. With this technology stack, we can automatically generate, configure & renewe the SSL certificates for custom domains of our clients.

Read more [ohdear.app]

How to integrate Elasticsearch in your Laravel App

madewithlove.be

Tony Messias wrote a good post on the Madewithlove blog on how to get started using Elastichsearch in a Laravel app.

One of the most popular ways is using Elasticsearch. It is a very powerful tool and it comes with a variety of useful features and complementary tools. We are going to cover the basics here and leave you with some links for more resources if you want to dig further.

Read more [madewithlove.be]

Watch the Flare reveal live original

by Freek Van der Herten – 2 minute read

These past eight months Marcel Pociot, me and our teams at Beyond Code and Spatie have been working on a secret project called Flare. We believe that Flare is going to change the way you work with Laravel. To be kept in the loop subscribe to our mailinglist.

We are going to launch it this Friday at Laracon EU at 16.30 local time (15:30 CET). The Laravel News YouTube channel will live stream the launch. You can watch the stream right below.

Read more

Multiple forms with same input names on one page

stefanbauer.me

Stefan Bauer explains how to handle error message when you have multiple forms on one page

Here's another tip! Even if it's documented here I just wanted to show it. Here's the deal: Imagine you have multiple forms one page. For example one contact form and another newsletter signup form. Both of them might have an email field. So who do you know which email field doesn't validate and throws an error?

Read more [stefanbauer.me]