Laravel — Improve Email Validation
Let’s assume that in your Laravel application, you have a form in which you use a Form Request to validate several fields, including the email. To validate the email address, you use the email...
Explore a variety of practical Laravel easy-to-follow tutorials that cover both front-end and back-end aspects.
Let’s assume that in your Laravel application, you have a form in which you use a Form Request to validate several fields, including the email. To validate the email address, you use the email...
Laravel provides two common methods for retrieving configuration data: env() and config(). While they may seem similar at first, there are important differences between them. In this post, we’ll explore the differences between env()...
In this article, we will discuss 3 ways to check if a file exists using Laravel’s functionalities. Storage Facade Let’s start off with the Storage Facade which is part of the Laravel filesystem. It...
Let’s look at how we can check if a route exists in a Laravel project. We’re going to use the has() method from the Route facade. Note that it tries to find the...
Let’s imagine the following scenario. You’re working on a monolith or a macroservice project. And a mobile app developer comes to you and says: – Hey, can you help me debug this API endpoint?...
Let’s look at 3 simple methods to check if debug mode is enabled in a Laravel project. Check .env file Let’s start with the first and the most obvious one. Open the...
Let’s have a look at several ways you can check and get the Laravel version your app is using. Check Laravel version via CLI Check Laravel version via PHP Using Application::VERSION is faster because...
With the release of Laravel 9.32, dd() and dump() functions’ output has been improved. They are now showing the source file and the line where they’re called. This is super helpful if...
With the release of Laravel 9.32, the Benchmark helper was introduced. The measure() static method takes in a Closure and outputs the execution time in milliseconds. We can also pass an array of...
Let’s look at how we can add custom headers to HTTP responses in a Laravel application. Create a Middleware One good solution, in this case, is to create a Middleware. Run the following...