Reusable code snippets using Live Templates in PHPStorm

— Let’s just admit this. If you’re a developer who works with PHP and you haven’t heard about PHPStorm, you’re assumed to be living in the rocks. Because PHPStorm is the best PHP IDE exist right now IMHO. The tagline on the homepage of it reads as “The lightening-smart IDE for PHP” and it’s really true. It has got all the features you’d need in order to become a fluent PHP programmer.

A closer look at Invokable classes in PHP

— In PHP, Invokables refer to any class that may be instantiated without any constructor arguments. In other words, one should be able to create an instance solely be calling new $className(). To implement an invokable class, one needs to use __invoke() magic method of PHP. Before we understand how invokable exactly works, let’s take a look why invokable classes even exists in PHP.

Logout from every devices except the currently logged in one in Laravel

— Every robust web app has this feature where you’re provided with a setting through which you can choose to logout from all the devices you’ve been logged in from previously, except the current one. This is certainly a nice security feature that you can provide to your user without them even asking for it and if your app is built on top of Laravel 5.6, this comes out-of-the-box.

PHP 7.4 will support first-class property type declarations

— With the introduction of scalar type declaration and return type declaration in PHP 7.0, the language’s type system got improved at some extent. Although it’s great to have some layer of strictness, it’s still missing the support to declare typed properties. But from PHP 7.4, it seems, it’s going to change because according to this accepted RFC, PHP 7.4 will be getting support for first-class property type declarations.

Attribute casting in Laravel Eloquent

— Laravel’s Eloquent is without a doubt a great ORM exists right now. It has some of the features which makes it ahead of its competitions. One such feature the ORM provides is called “Attribute casting”.