We are friends who love programming and we would like to help learn it and spread it to others and help solve the problems that our developers friends also face
Laravel tip.
Cache key names as REUSABLE constants.
Don't put cache key names as raw strings.
If someone MISTYPES 'products.count' somewhere, cache invalidation breaks.
And you won't get an error. Just stale data forever.
Make it a constant on the model.
Use it everywhere.
I still see a lot of Laravel code using `count() > 0` just to check if records exist.
`exists()` is more expressive, more efficient, and tells future readers exactly what you're trying to do.
Small change. Better code. 👇
Laravel tip.
Why `@props` in Blade components matters.
Forget to declare a passed-in model, and {{ $attributes->merge() }} happily serializes the ENTIRE model into your HTML.
Bloated HTML size + data leak.
`@props` pulls it out of `$attributes`.
Hey Laravel Developers 👩💻
Oftentimes, after building an API for a client, the next thing that comes to mind is how can I quickly authenticate the client?
Not to worry, if the client is making a server-to-server call to your API, you can easily add HTTP Basic Auth to your API using the Auth::onceBasic() method.
The middleware below looks for the Authorization header in the form "Basic base64(username:password)" and authenticates each API request where this middleware is attached.
#laravel #php
Progress Report: May 2026
A recent security audit flagged a vulnerability.
There's no evidence it was exploited, but patches are available and we strongly recommend updating.
If you faced something, please share.
Big respect to everyone helping make the #Laravel ecosystem safer 🙌
Know More👇
#Laravel Tip
Native Automatic Deletion 🪄
Sometimes you may want to delete old entries, you can use the Prunable Trait. No need to write custom commands
Hey Laravel Developers
We know that PHP handles memory management automatically, and objects are generally destroyed once they are no longer referenced.
However, sometimes it is still better to manually unset a variable and free up memory earlier, especially when working with long-running functions or scripts.
This is because a variable remains in scope until the function or script finishes execution.
Even if you no longer need the variable, PHP may continue holding the memory until it goes out of scope. By using unset(), you can release that memory sooner.
Check the code example below for a better understanding!
#laravel #php
#PHP Tip
Did you know... You can destructure arrays directly in the right-hand part of a foreach loop!
Give it a shot for cleaner and more readable code!
Hey Laravel Developers 👩💻
Working with addresses, locations, and proximity is essential in modern web applications.
Recently, I discovered a Laravel package that supports most of these features out of the box, which can help fast-track development.
The package includes features like:
📦 Adding billing and shipping address relationships to any Eloquent model.
⭐ Ability to mark a particular address as primary.
📍 Ability to find addresses within a specific range.
Please do give it a try and share your feedback.
#laravel #php
Laravel tip.
Did you know Laravel provides `fullUrlWithoutQuery()` to generate URLs while excluding specific query parameters.
Perfect for pagination links, filtering, or cleaning up URL state.
Some cool new stuff in this week's Laravel release.
Laravel’s password validation rule can now generate an HTML `passwordrules` attribute string.
Great for helping password managers like 1Password suggest valid passwords.
I just can't live without this Arr::arrow() helper.
It is just the cleanest way to handle partial JSON column updates directly from a validated request and avoid overwriting existing data. 📝
PHP 8.6 is getting a built-in `SortDirection` enum 🎉
No more 'asc'/'desc' for sorting 👏
SortDirection::Ascending
SortDirection::Descending
Laravel already supports it via Symfony’s PHP 8.6 polyfill.
Laravel tip.
Laravel translation files support automatic capitalization using `:Variable` or `:VARIABLE` syntax in your lang folder.
Just pass your variables normally and Laravel handles the rest.