Hey Laravel Developers,
Laravel’s job middleware allows us to easily execute code during a job’s lifecycle. It helps keep job classes free from boilerplate and repetitive code, while also improving readability.
Starting with Laravel v13.18.1, we have a new Release middleware, which allows us to release a job back onto the queue based on a condition.
Here is an example code snippet for the same, in which we are charging a customer for an order only if the inventory is reserved, or else we are releasing the job back to the queue for retrying again.
#laravel #php
Laravel 13.17 introduced first-class route metadata.
Instead of hiding custom data in route defaults or action arrays, you now have a dedicated API.
Feels like a small feature, but it'll make packages and middleware much cleaner.
‼️🚨 Critical remote code execution in libssh2, the SSH client library embedded in countless tools: CVE-2026-55200, rated CVSS 9.2 by VulnCheck. Every version up to and including 1.11.1 is affected.
It's an out-of-bounds heap write in ssh2_transport_read(), which fails to bound-check the SSH packet_length field. A malicious or MITM'd SSH server can send oversized packets to corrupt memory and run code on the connecting client.
No known exploitation yet and it's not in CISA's KEV. Fix: move to a build that includes commit 7acf3df (PR #2052), and inventory anything that links libssh2 for SSH, SCP, or SFTP.
Hey Laravel Developers 👩💻
Starting with Laravel v13.15.0, we have a new rememberWithState() method available on the Cache facade.
This method basically does two things!
Firstly, it checks whether the given cache key exists in the store. If it exists, it simply returns the value. Otherwise, if the key does not exist, it executes the callback and stores the value under the corresponding key.
This is exactly what the existing remember() method does.
But this method also returns a Boolean value (true or false), which determines whether the cache value already existed or was generated just now.
A major use case for this method could be sending a custom response header to the client that indicates the cache status.
#laravel #php
Hey Laravel Developers 👩💻
You must be aware of the Notification class that comes with Laravel, which allows us to easily configure different aspects of the notifications being sent to users.
Recently, Laravel added two new helper methods to the MailMessage class: attachFromStorage() and attachFromStorageDisk().
As their names suggest, these methods allow us to easily attach files from any given storage disk.
Here is the before and after of what can be changed!
#laravel #php
Hey Laravel Developers 👩💻
You might have used the Cache::get() method in Laravel to fetch a value for a key from the cache store.
But sometimes, there is a possibility that within a single request lifecycle, the same key is accessed multiple times in different places.
If you use the Cache::get() method, this would result in multiple calls to the Redis server to fetch the value.
To optimise this, we can make use of the Cache::memo() driver, which fetches the value from the cache store on the first request and keeps it in memory.
For all subsequent fetches, the value is returned from memory, avoiding additional requests to Redis or any other cache store.
#laravel #php
php devs, we no longer need to duct-tape python scripts just to parse a pdf 😭
launching Parsel: a fast memory efficient local document parser for PHP.
pdfs, office docs & images → text, structured data, bboxes, screenshots.
built for AI/RAG, NLP, invoices, search, and messy docs.
composer require shipfastlabs/parsel
Hey Laravel Developers 👩💻
In most Laravel applications for authentication, we use the default configuration provided by Laravel, which is the session guard along with the users table as the provider.
But for large ERP applications, you might often have multiple types of users stored in different tables, like users, customers, riders, etc.
What if you want to allow these other types of users to log in to the system as well?
No worries, Laravel provides us with the option to configure multiple guards and providers in our applications to seamlessly work with multiple user types.
Check out the example usage in the screenshot below.
#laravel #php
Hey Laravel Developers 👩💻
We often know that file uploads are one of the most common features of a typical web application.
But, oftentimes in many codebases, I have seen file upload validation being incomplete.
Generally speaking, developers only make use of the extensions rule to validate the type of file.
But this could be dangerous because extensions can be easily spoofed on the client side.
Hence, for file uploads, always make use of the mimes validation rule along with the extensions rule for additional security.
The mimes validation rule actually checks the file contents and throws a ValidationException in case the file contents do not match the given types.
#laravel #php