June 1, 2020 — With PHP 5, the core team had introduced type declarations (also known as type-hinting) that allow functions to require that parameters are of a certain type at call time. If the given value is of the incorrect type, then an error is generated: in PHP 5, this will be a recoverable fatal error, while PHP 7 will throw a TypeError exception.
May 31, 2020 — Sometimes, all you want to do is a custom type populated with a set of predefined strings which can be used to restrict a variable to only have values from this set of strings.
May 28, 2020 — The usual way of validating request attributes in Laravel is by making
Illuminate\Support\Facades\Validator instance with your static rules that never change like so.
May 27, 2020 — In TypeScript, you assign types to variables and function parameters to catch type related errors early, even before you run the code. But TypeScript doesn’t warn you when you assign
undefined to the variables of common types.
May 21, 2020 — If you’re using GitHub repository’s web URL as its remote and if you’ve two-factor authentication turned on for your account, you’re going to face an issue in authenticating your account while doing certain git actions such as
May 20, 2020 — Laravel comes with a multitude of ways to validate request parameters. For instance, you could use
Illuminate\Http\Request’s validate method where you can specify all the fields that you would want to get validated inside controller’s action. You can do it like so.
May 19, 2020 — There might be cases where you would like to check if the device on which the website is loading is connected to the internet or not. For instance, this can be used to show the user the message if their device is offline or to disable some functionality of the application if the device is offline.
May 18, 2020 — You’ve probably seen or have used this feature where you can upload files by dropping the selected files into the specific area. For example, how Gmail handles this while drafting emails.
Download my eBook
(Includes PHP 8.1 and 8.2)
Follow me everywhere