Welcome to the home for Laravel-oriented content on Fly.
By Chris Fidao
12 min Read
A NativePHP Example
NativePHP is out (in alpha currently), and I’ve had a great time building a desktop app in Laravel.
Along the way I’ve discovered a few not-yet-documented goodies that I’m excited to share.
Writing Laravel and seeing it translated into “native” des
Did you know that there are reflectors on the moon? The Apollo missions left them on the surface of the moon for scientists on earth to shoot lasers at. By measuring the time it takes for the laser to go to the moon and back, the scientists can calcu
Forms are why I use Laravel. Anything that abstracts away the tedium of form security, validation, user-messaging (“hey this is required”), and saving state is my favorite thing. This is, in fact, a huge part of what keeps me using Laravel over any o
We’re going to create a new app, add Livewire 3, and show how to persist a chat widget while navigating through the app.
Here’s a GitHub repository with the final code.
composer create-project laravel/laravel livewire3-persist
In the recent past, we were able to dump out the SQL our query builder was generating like so:
$filter = 'wew, dogs';
// Using the `toSql()` helper
->select(['id', 'col1', 'col2'])
->join('bar', 'foo.bar_id', 'bar.
One of Laravel’s new, fun enhancements is the ability to run scheduled commands (or jobs) more than once per minute!
Notoriously, CRON can only run tasks every 1 minute or slower. Laravel’s scheduler, typically driven by CRON, therefore only ran onc
Let’s be real here: FilamentPHP has great styling out of the box, using tailwindcss and a coherent set of components. While beauty may be subjective, it’s a clear and inoffensive style anyone can appreciate.
But let me ask you this: How do you reac
Most Laravel libaries that have drivers use a Manager class.
A “driver” is an implementation of some library, but (generally) using a different underlying technology.
A few example Laravel libraries with drivers (multiple implementations) are: Queu
Have you ever written a test case, expecting it will pass, only to find out it doesn’t? Today, we’ll create a test for a Laravel Zero console command, and use its assertCommandCalled helper to assert one command calls another.
We’ll then see how ea
Laravel queues are stopped gracefully. What does this mean?
During a deployment, you likely restart your queue workers using something like artisan queue:restart or supervisorctl restart <worker-name>.
Laravel has graciously noticed that we don’t
As Laravel developers we know how productive a framework can be: It provides a set of common components, reusable functionality and most importantly, a set of guidelines that make everyone using the framework more efficient.
Knowing this, the fine f
We’re going to talk about running Laravel as a worker on Fly.io. This isn’t really anything special (we aren’t out to make things hard), but it’s useful to see how it essentially becomes a lesson in Docker.
The “usual” use case on Fly.io is running
Need to run a Laravel backend along with a React frontend? That’s going to be a piece of cake with Inertia! Inertia allows us to work in both monolithic Laravel land, and our preferred (Inertia-supported) frontend framework or library.
Learning multiple programming languages is good — there are a lot of benefits!
One such benefit is the ability to use what a language is strongest at. Some top-of-mind examples include Python’s various data-munging libraries, or Go’s concurrency to
The bane of client side pagination stems from our retrieval of entire bulky data sets in one go. But, do we really need to get the entire data set all at once?
In this article, we’ll apply a combination of data allowance and accumulation strategies
You can use fly launch to get you up and running quickly with Laravel, but let’s talk about all the other stuff you probably want:
cron (Laravel Scheduler)
We’re gonna spin up a new Laravel installation, add some user authentic
The real story is: Recipe sites are bloated. Rumor has it that this is because you can’t copyright a recipe, but ca
Here’s a news flash: You can write console applications with Laravel! Actually, it’s kinda with Laravel and kinda without. Let’s take a closer look at Laravel Zero and some cool things you might want to know about!
Support for Facades
First off: ther
Creating a Middleware to Globally Log Submissions in Livewire
Ever implemented logic that applied to multiple Livewire components? Why not use a middleware to make it available across Livewire components?
For example: Imagine having two Livewire components that handle two different form submissions. If, say, e
Securing Access to Livewire components with Inline Policies, Traits, and Middlewares
How do we safeguard Livewire components against unauthorized access? How do we restrict access to its view or specific action based on a current user’s permissions?
In this article we’ll go through three different ways to restrict ac
It’s almost a hidden feature - Fly.io provides Grafana dashboards with helpful metrics for all of your Fly.io apps.
All you have to do is head to https://fly-metrics.net/.
👉 Here’s the kicker: If your app publishes some metrics, Fly.io will read
Sharing Google Maps Data across Separate Livewire Components
Let’s say we have separate Livewire components for:
A Google Map Element - an interactive map for adding and deleting location markers
A Search box Element - to re-focus the Google Map element to a user given location
A Drop Down Element - to filt
Invoicing is a hugely important part of any business. By having your Laravel app generate invoices automatically, you can make the life of your users a lot easier and we all know that means they’ll hang around longer and be more keen to use your apps
Fly.io machines have been announced and have been made the default way new apps will be run on Fly.io’s platform.
They have many advantages, and one of them is their super-fast boot times.
In this article, I’ll show you how to use machines to run bo
Laravel 10 has released the Laravel’s Process facade, which make running external commands super easily.
$result = Process::run("php -v");
This uses Symfony Process under the hood, and adds a TON of quality-of
No-Upload, Batched Import of Data with SheetJS CE and Livewire
When we think about first steps in importing spreadsheet data, we usually think of uploading the file first to the server, before processing the import.
But. What if we didn’t need to upload the file at all?
In this article, we’ll import data from
SPAs always are a bit fragile. Nevermind the game of “where’s the business logic?” (a rant I won’t bother writing), splitting the frontend from the backend makes hosting SPAs harder.
The complications are mostly related to security concerns, such a
Alright drumrolls. Because today, we’ll intercept three user-video interaction events, and use Livewire to easily send event data to our server!
There are cases when we’d want to get insight on how users interact with the video files we d
The deal with React is that I don’t want it, but I’m jealous of the quality of React components.
Auto complete fields are an example. There’s a lot of hidden complexity and (even still) browser compatibility issues.
Here’s the rub: There are so ma
Shopping carts don’t empty out when the user leaves the page. Why? Well, for that I’ll need to take you back in time. Cue the wavy flashback transition!
Once upon a time, there was an everyday, regular, normal guy named Jack. Jack loved shopping onl
Concurrent, Chunked, Multi-File Uploads with Livewire
Livewire offers a quick way to upload multiple files in one go with the use of its WithFileUploads trait.
This however only uploads the files in one way: all files in one request, each file sent as a whole.
There are times when we’d want to send th
In the article Chunked File Upload with Livewire we easily uploaded a file in separate, smaller chunks using Livewire’s upload function. Today, we’ll create a progress bar indicator to let our users know how much progress has been made uploading the
PHP and MySQL go together like peas and carrots. This is because they both let you get away with a lot of crap, like pretending numbers and strings are interchangeable.
However, some people (within the PHP world) are rebels against the mainstream.
Servers are configured to limit the size of requests they can accept. This is done to avoid long processing times, resulting unavailability, and potential security risks that come with processing large requests in one go.
What happens when a user r
We’re a fan of NATS here at Fly.io. NATS enables your server instances to communicate with each other with very little hassle - think PubSub, although there are a few different ways to push data around with NATS.
The general setup is to run 1 or mor
Previously I wrote about spinning up Fly Machines to run tasks “on-demand”. Machines are great because they stop when a task finishes - no need to waste (paid) CPU cycles.
However, I hand-waved over the need for concurrency. To run multiple tasks at
Delayed Display of Isolated PDFs with Fly-replay and Livewire
Running our Laravel application close to our users reduces geographical latency. What’s more, with Fly.io, we get to easily do global deployments with just a few commands!
However, as we’ve established in Taking Laravel Global, files stored in one
How many of you remember the launch of Oneplus’ first product? It was called the Oneplus One and it was marketed as the flagship killer. The name was warranted: It had flagship specs for a lower price than the flagships that time. I remember buying o
Users are not equal.
You heard me. Some users are above others. They are allowed to do more than other users. They can see things other users cannot see. Sometimes they can even remove lower-class users!
Now, this is not a weirdly abstract horror m
This article foc
We’re going to learn how to use Fly Machines to run short-lived tasks efficiently.
This boils down to having a process to run (an artisan command, in our case), and a VM ready to run that command. The VM will start, run the command, and stop when th
In Hoarding Order with Livewire we implemented a client paginated table that relies on data accumulation. Instead of waiting for an entire dataset to load, the table periodically received and accumulated smaller portions of the dataset using Livewire
We’re going to see how to stream content to the browser using Livewire.
🤔 What’s that mean?
Here’s an example from Chipper CI, which runs “builds” when you push code to git. When a command is run (perhaps composer install), the build output is stre
I’ve never met an app that didn’t make me wish for a global notification system.
What’s that mean exactly? I always want an easy way to display notifications on any page of my application. It’s “global” because I can show it anywhere.
In this post we’ll craft ourselves a hassle-free ordering of groupable data across table pages, and land our users a lag-free pagination experience.
In order to do so, we’ll use Livewire’s polling feature to accumulate ordered data, and keep a clien
Integrating the Elastic Stack (ELK) into a Laravel app on Fly.io
The Elastic stack is hugely powerful, and a great tool in any developer’s arsenal. Since this is an intro I’ll keep it simple but please let me know if you’re interested in seeing more of this! You can find me on twitter or in the Laravel category of
I’ve been on the search for a remote development setup for the better part of 11 years.
Originally this was due to falling in love with an underpowered Macbook Air. Now I’m older and impatient - I’m opting out of dependency hell.
Recently, I landed
Tables have always played an essential role in the history of web development. Decades ago, tables lived their golden age; they were used not only to structure data but also for the layout of web pages. It was easy to arrange things with tables, a <tr
Fly.io puts your application close to your users by making global deployments easy. It’s literally just a few commands.
Here’s an example of showing an app, currently in DFW (Dallas), scaled out to also include Frankfurt and Singapore:
We’re going to see how to serve Laravel globally.
Fly.io is great at serving your application from servers in multiple regions. PlanetScale is great at putting your data close to your application servers!
We’re going to use PlanetScale Portals to r
If you’ve read anything on Fly.io, you’ve probably noticed a snippet like this:
We transmogrify Docker containers into lightweight micro-VMs and run them on our own hardware in racks around the world, so your apps can run close to your users.
When it comes to form elements, we might immediately reach for an open-source or paid library. Pre-built components speed up development and using well-tested, robust libraries take a lot of pressure off our shoulders.
But what about when we need so