Software Developer
5 years building with Laravel, React, and TypeScript.
Focus on clean architecture and performance. Docker and Redis are my defaults.
Pragm
Useful Laravel package!
GitHub - mayaramyadav/laravel-ocr: Laravel OCR & Document Data Extractor – A powerful OCR and document parsing engine for Laravel https://t.co/sdPByrRnrH
Laravel Boost now includes a skill for testing best practices. 🟢
It gives AI agents clearer guidance on what to test, when to stop, and how to avoid redundant or brittle tests, while adapting to Pest, PHPUnit, browser testing, and the tools already installed in your project.
Hey Laravel developers 👩💻
I learned something new after hearing Freek's talk at Laracon US.
This tip is a gem if you are building packages for Laravel.
One thing that stood out: avoid adding a config option for every small behaviour.
For example, instead of adding package config for soft deleting, table names, connection names, scopes, or extra HTTP headers, expose the model, action, or client class through config.
That way, users can customise behaviour in their own class, and your package config does not keep growing forever.
#laravel #php
Laravel 13.20+ finally brings first-party image processing. 🖼️
Huge shout-out to @enunomaduro for cooking this one.
$request->image(), Storage::image(), configurable drivers, and immutable transformations.
This feels like it has always belonged in Laravel.
With new security incident(s), we PHP/Laravel devs probably should stop running `composer update` blindly, trusting the latest versions.
Modern apps are mostly DEPENDENCIES.
Security is no longer just about your code, SQL injections or XSS attacks on your website.
So, for packages, probably lock SPECIFIC versions.
Probably do not install anything "too fresh".
Consider NOT using external packages when possible/logical.
I'm currently writing a much longer tutorial with security recommendations, possibly will even turn it into a course.
Attention Filament users: we’ve identified and resolved a few security vulnerabilities.
To address these vulnerabilities in your applications, please update to the following versions:
v3.3.52
v4.11.5
v5.6.5
Most Laravel developers know about:
withCount()
withSum()
withMax()
But very few know all of them are powered by one underrated method:
withAggregate()
It can even fetch a single relationship column
without loading the full model.
Pretty elegant Laravel feature.
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
Laravel 13.9 adds the `Conditionable` trait to `PendingDispatch` 👀
You can now use `when()` and `unless()` directly on dispatched jobs for much cleaner inline queue configuration.
A small addition that makes dispatch logic feel way more fluent.
after 30 years, we might actually get generics in php
the rfc is looking promising, and i'm genuinely excited about this
full video here: https://t.co/6uw4yFfbEQ
Hey Laravel Developers 👩💻
Starting with Laravel v13.8.0, we have a new -- environment option available for the schedule:list command.
This option displays only the commands that would run in a given environment.
Without this option, the command prints all scheduled commands irrespective of the environment, which could be misleading in certain cases.
Also, do you think the default behaviour of this command should be to show only the commands scheduled for the current environment?
#laravel #php
Hey Laravel Developers 👩💻
If you work with Carbon, here is one thing you must be aware of.
By default, whenever you add a month to a Carbon instance, it works in overflow mode.
Let’s take an example—what do you think the output would be if you add one month to 31st January using the addMonth() method?
If you expect the output to be 28th February, you are wrong. The output comes out to be 3rd March.
This happens because, by default, if PHP does not find a matching date in the next month, it simply carries the extra days forward into the following month. This behavior is called overflow.
These issues generally occur at the end of the month, like the 29th, 30th, or 31st.
However, this can be problematic in many applications, such as payroll or subscription systems.
If you are working with such scenarios, make sure to consider using the no overflow methods.
#laravel #php
Hey Laravel Developers 👩💻
Starting with Laravel v13.7.0, we can now run some logic in case our Queue Job is interrupted in between because the queue worker was stopped.
To do this, you just have to implement the interrupted(), which comes from the Interruptible interface inside your Job file.
Whatever code is written inside this method will be executed in case the job was interrupted during the worker shutdown.
I personally would use this as a clean-up method to retain consistency in the system, so that the job can be retried again in the future!
#laravel #php
Laravel tip.
In Eloquent API resources, `whenCounted()` allows you to CONDITIONALLY output relationship aggregates.
The attribute is SKIPPED entirely if the relationship count wasn't eager loaded, avoiding null values.
Hey Laravel Developers 👩💻
While running the php artisan test command, you must be aware of the --parallel option, which runs the test cases in parallel using all of the available CPU cores.
But did you know that we have the same option available for the pint command as well?
You can also specify the max processes, which would limit the total number of parallel processes being used by pint.
#laravel #php