Sign in

Oussama

@oussamamater.bsky.social
27 followers 14 following 77 posts

I write code.

PostsRepliesMedia
Oussama @oussamamater.bsky.social · 22/10/2025
Laravel Tip 💡: Wrap a Pipeline in a DB Transaction Elegantly If you are using Laravel pipelines and wrapping the whole thing in a DB transaction, since Laravel v12.22 you can simplify your code by just calling "withinTransaction()" on the pipeline 🚀 #laravel
051 0
Oussama @oussamamater.bsky.social · 15/09/2025
Laravel Tip 💡: Handle Pluralization Elegantly Did you know that besides localization, Laravel also handles pluralization out of the box? When you have messages in different plural forms, you can define them all at once and use ranges to choose the right format 🚀 #laravel
010 0
Oussama @oussamamater.bsky.social · 14/09/2025
Laravel Tip 💡: Detect User Language Laravel uses Symfony's HttpFoundation component, which comes with some nice goodies. If you are working with localization and need to detect the user's preferred language, you can just call "getPreferredLanguage" 🚀 #laravel
030 0
Oussama @oussamamater.bsky.social · 13/09/2025
Laravel Tip 💡: Better If Statements in Blade If you are working with Blade, you will almost certainly use an if statement, and chances are, there is already a shortcut directive for what you need 🚀 #laravel
030 0
Oussama @oussamamater.bsky.social · 07/09/2025
Laravel Tip 💡: The New "whereAttachedTo" Method We have all used "whereHas", and sometimes you need to constrain it to match specific models. Since Laravel v12.13, you can use "whereAttachedTo" for exactly that 🚀 #laravel
020 0
Oussama @oussamamater.bsky.social · 03/09/2025
Laravel Tip 💡: Boot Traits with Attributes Bootable traits are great, but their naming convention can be painful. Since Laravel v12.22, you can fully customize method names using PHP attributes 🚀 #laravel
020 0
Oussama @oussamamater.bsky.social · 31/08/2025
Laravel Tip 💡: The "use" Blade Directive We have all probably used an enum in Blade at some point. While you can drop in raw PHP, Laravel v10 and upward have the "use" directive for exactly this 🚀 #laravel
000 0
Oussama @oussamamater.bsky.social · 28/08/2025
Laravel Tip 💡: Generate Realistic Test Sentences Since Laravel uses FakerPHP under the hood, you can use "realText" to generate more realistic sentences for your tests instead of predictable dummy #laravel
020 0
Oussama @oussamamater.bsky.social · 23/08/2025
Laravel dropped a new package "Laravel Boost". It makes AI suck less by giving it a bunch of tools to better understand your app, and it's great. But I think we can give it an extra boost. blog.oussama-mater.tech/laravel-boost/ #laravel #ai
blog.oussama-mater.tech
Boosting Laravel Boost
In the era of AI, LLMs are undeniably part of our workflow. Let's make them suck less with Laravel Boost.
040 0
Oussama @oussamamater.bsky.social · 28/07/2025
Laravel Tip 💡: Date Checks with Carbon I know you've had to check if a date has expired or is in the future at least once. Since Laravel uses Carbon under the hood, you've got access to a ton of helpers to handle all that elegantly 🚀 #laravel
030 0
Oussama @oussamamater.bsky.social · 21/07/2025
Laravel Tip 💡: Select Sub-Arrays There will be times when you need to extract a sub-array from the main one, whether it's from a JSON response, your models, or whatever. While you could use map for that, Laravel ships with a much more elegant helper, "select", just for this 🚀 #laravel
010 0
Oussama @oussamamater.bsky.social · 15/07/2025
Laravel Tip 💡: Clamp Numbers Have you ever needed to keep a number within a specific range, like a rating or a computed value? While you can hack your way through with min and max, Laravel ships with an elegant helper "clamp" to do exactly that 🚀 #laravel
020 0
Oussama @oussamamater.bsky.social · 12/07/2025
Laravel Tip 💡: Global Middleware for Jobs Did you know you can apply global job middleware? It can be really useful for custom logging and monitoring, like instantly notifying Slack or Discord about slower-than-usual jobs 🚀 #laravel
000 0
Oussama @oussamamater.bsky.social · 09/07/2025
Allows GIF. I upload GIF. Shows Static 👍
000 0
Oussama @oussamamater.bsky.social · 09/07/2025
Laravel Tip 💡: Encrypt Your Jobs If you are working with sensitive jobs, you can instruct Laravel to encrypt the payload by using the "ShouldBeEncrypted" interface. How cool is this? 🚀 #laravel
120 0
Oussama @oussamamater.bsky.social · 06/07/2025
Laravel Tip 💡: The "forelse" Blade Directive When looping over a collection, you have probably checked its count first to handle the empty state. But the "forelse" Blade directive has existed forever, and it does exactly that, elegantly 🚀 #laravel
030 0
Oussama @oussamamater.bsky.social · 29/06/2025
Laravel Tip 💡: Record API Responses as Fixtures If you are testing your API integrations (which you should) you are probably using the "fake()" method. To quickly prepare a stub for testing, you can use the "sink()" method to save the response into a fixture 🚀 #laravel
020 0
Oussama @oussamamater.bsky.social · 26/06/2025
Laravel Tip 💡: Display Remaining Attempts for a Rate-Limited Job If you have a rate-limited job that can be dispatched via a UI, you can greatly improve the UX by displaying how many attempts are remaining for the day 🚀 #laravel
030 0
Oussama @oussamamater.bsky.social · 21/06/2025
Laravel Tip💡: Fail Jobs on Specific Exceptions Ever needed to fail a job for specific exceptions and had to use a try-catch with "fail()"? Since Laravel v12.19, you can do it more elegantly with the new "InvalidContentFormatException" middleware 🚀 #laravel
051 0
Oussama @oussamamater.bsky.social · 10/06/2025
Laravel Tip 💡: Real-Time Download Progress If you ever need to download a file in your Laravel app, consider using Guzzle's progress option. It gives you real-time updates on the download, which you can broadcast to your UI, display in the console, or handle however you like 🚀 #laravel
031 0
Oussama @oussamamater.bsky.social · 03/06/2025
Laravel Tip 💡: Confirm to Proceed Need to confirm before running a command? Laravel ships with the "ConfirmableTrait" for that exactly. Just call "confirmToProceed()" for confirmation, and skip the prompt anytime with the "--force" option 🚀 #laravel
020 0
Oussama @oussamamater.bsky.social · 01/06/2025
Laravel Tip 💡: Use Contextual Attributes You've probably had to initialize attributes with config values before. Laravel v11 makes it easier with contextual attributes. You can inject values directly, use constructor property promotion, and skip the boilerplate. It's just #laravel
031 0
Oussama @oussamamater.bsky.social · 26/05/2025
Laravel Tip 💡: HTTP Response Status Helpers When making API requests, you often need to check the response status code. While you can do this manually, Laravel provides wrappers for almost all status codes, which you can use for elegant and readable checks 🚀 #laravel
040 0
Oussama @oussamamater.bsky.social · 16/05/2025
Yeah, I'm basically using the JobRepository from Horizon — it's what the API uses under the hood. I built a couple of tools around it and added the missing features I wanted in Horizon, and that's it. For the MCP server itself, I used the innoge/laravel-mcp package. It can be really useful tbh 🙌🏽
010 0
Oussama @oussamamater.bsky.social · 14/05/2025
Making Laravel Horizon suck less with an MCP server — delete failed jobs, figure out what went wrong, see job stats, and more. Basically, all the things Horizon is missing 🤖
120 0
Oussama @oussamamater.bsky.social · 13/05/2025
You can find all the code here github.com/OussamaMater...
github.com
000 0
Oussama @oussamamater.bsky.social · 13/05/2025
PHP Tip 💡: Better Custom Exceptions Do you use custom exceptions in your codebase and end up with multiple empty classes? You can group all related exceptions into a single class and use static methods to create english-like code that immediately tells you what went wrong 🚀 #php
110 0
Oussama @oussamamater.bsky.social · 10/05/2025
Laravel Tip 💡: Wrap Configs in Classes Laravel configs often get reused across the codebase, which can become painful to manage. Instead, group related configs in a class for cleaner, easier maintenance 🚀 #laravel
020 0
Oussama @oussamamater.bsky.social · 04/05/2025
Laravel Tip 💡: Reusable Pipelines Pipelines allow you to split a large task into smaller, more manageable ones. Sometimes, you may want to use the same pipeline in different places, and it turns out Laravel allows you to define reusable pipelines out of the box 🚀 #laravel
050 0
Oussama @oussamamater.bsky.social · 27/04/2025
Laravel Tip 💡: Restore Trashed Models Have you ever needed to restore trashed models? While you could do this manually, Laravel ships with a restore method for exactly this 🚀 #laravel
010 0
Oussama @oussamamater.bsky.social · 16/04/2025
Laravel Tip 💡: Monitor Failed Jobs Have you ever needed to keep an eye on failed jobs and get notified when that happens? The failing method allows you to do exactly that 🚀 #laravel
020 0
Oussama @oussamamater.bsky.social · 06/04/2025
Laravel Tip 💡: Control Notification Delivery There are times when you may need to determine whether a queued notification should be sent to the user, such as when users can opt out of notifications. Laravel ships with the "shouldSend" to do exactly that 🚀 #laravel
040 0
Oussama @oussamamater.bsky.social · 25/03/2025
Laravel Tip 💡: Prompt for Missing Arguments Have you ever needed to ensure users provide the required console arguments? Laravel ships with the "PromptsForMissingInput" contract to automatically prompt the user for missing input 🚀 #laravel
030 0
Oussama @oussamamater.bsky.social · 22/03/2025
🙌
000 0
Oussama @oussamamater.bsky.social · 22/03/2025
Its very elegant 💯
010 0
Oussama @oussamamater.bsky.social · 20/03/2025
PHP Tip 💡: First Class Callables PHP 8.1 introduced first class callables. They can add syntactic sugar especially when working with Laravel collections, where closures are commonly used 🚀 #php
240 0
Oussama @oussamamater.bsky.social · 19/03/2025
🙌🙌
000 0
Oussama @oussamamater.bsky.social · 17/03/2025
Nope, actually it existed Laravel v8.28 github.com/laravel/fram...
github.com
Release v8.28.0 · laravel/framework
Added Allow users to specify configuration keys to be used for primitive binding (#36241) ArrayObject + Collection Custom Casts (#36245) Add view path method (af3a651) Changed Allow using dot sy...
100 0
Oussama @oussamamater.bsky.social · 16/03/2025
Laravel Tip 💡: Binding Primitives to Config Values Sometimes, you might need to bind a primitive to a value, such as a config value. Instead of using "give()" with a callback, Laravel ships with the "giveConfig" shortcut to do exactly that 🚀 #laravel
150 0
Oussama @oussamamater.bsky.social · 09/03/2025
Laravel Tip 💡: Convert Responses to Exceptions When consuming APIs, your request might fail. While you can manually check and throw exceptions, Laravel ships with handy helpers to do exactly that 🚀 #laravel
030 0
Oussama @oussamamater.bsky.social · 25/02/2025
Laravel Tip 💡: The "MassPrunable" trait If you are pruning models with the "Prunable" trait and not using model events, you might as well use the "MassPrunable" trait to prune them with a single query. This will be much more efficient 🚀 #laravel
020 0
Oussama @oussamamater.bsky.social · 22/02/2025
Laravel Tip 💡: Extract Text Between Strings Have you ever needed to extract text that is between 2 strings? Laravel ships with the "between" method to do exactly that 🚀 #laravel
020 0
Oussama @oussamamater.bsky.social · 17/02/2025
Laravel Tip 💡: Handle Command Output Did you know that Laravel's scheduler allows you to save or append a command’s output to a specific file? 🚀 #laravel
040 0
Oussama @oussamamater.bsky.social · 08/02/2025
Laravel Tip 💡: Customize the Default Password Rules Laravel ships with default password rules that suit most use cases. However, if you need to use specific rules, you don't have to discard the default ones. Instead, customize them, and keep your rules in one single place 🚀
020 0
Oussama @oussamamater.bsky.social · 03/02/2025
Laravel Tip 💡: Disable Scope Bindings Laravel assumes that nested route models are related, meaning it will automatically enforce parent-child relationships. You can disable scope bindings by chaining the "withoutScopeBindings" method 🚀 #laravel
010 0
Oussama @oussamamater.bsky.social · 01/02/2025
Laravel Tip 💡: Keep an Eye on Open Connections Did you know that Laravel 9.24 and upwards ships with the db:monitor command? This command allows you to keep an eye on how many open connections you have and react if you exceed a threshold 🚀 #laravel
050 0
Oussama @oussamamater.bsky.social · 30/01/2025
Laravel Tip 💡: The New "incrementOrCreate" Method As of Laravel v11.39.1, a new "incrementOrCreate" method has been introduced. It allows you to create a record if it does not exist or increment the specified column otherwise 🚀 #laravel
051 0
Oussama @oussamamater.bsky.social · 29/01/2025
Laravel Tip 💡: Conditional Validation Have you ever needed to apply a validation rule only in specific cases? For example, rejecting discount coupons for certain plans. While you could implement this manually, you can make use of the "sometimes" method to do exactly that 🚀 #laravel
010 0
Oussama @oussamamater.bsky.social · 26/01/2025
Laravel Tip 💡: Rate Limit Jobs Have you ever needed to rate-limit a job? Whether to avoid overwhelming an API or to limit free plan users from running too many jobs, Laravel allows you to define rate limiters and use them out of the box 🚀 #laravel
040 0
Oussama @oussamamater.bsky.social · 22/01/2025
Laravel Tip💡: Higher Order Messages with Conditionables If you are using the Conditionable trait in your classes or working with a Conditionable class like "Str", you can make use of higher order messages for an even more fluent API 🚀 #laravel
020 0