These commands show a list of installed packages that have updates available.

If you have a PHP application, and you use Composer as the package manager, then this article is for you.

While developing your applications, you might want to see the list of the packages that have available updates, so that you can easily check if you want to update them.

To do so, you can run either of these commands (They’re both the same):

composer outdatedcomposer show -lo

However, these commands return available updates for all your dependencies. You can simply use --direct or -D to restrict updates only for your direct dependencies.


There might be sometimes that you want to use Laravel query builder instead of the Eloquent either because of performance issues or the complexity of the query. The first problem you might have seen using the query builder could be hard coding the table names everywhere you want to use the query.

$users = \DB::table('users')->get();

The above code will work perfectly until you have used this code snippet in many places, and now you want to change the name of your tables. …

We’ve all seen many websites that were so slow, making us crazy not being fast enough, and we ended up leaving them and not coming back to them anymore.

Imagine having a website with a lot of requests to your database sooner or later you will have to dedicate a lot of computing power for responding DB requests, and you will have to pay tons of money for it.

So is there any way to lessen the DB queries while having the same number of requests?

Yes, caching can help with this issue.

If you’re using the Laravel framework as your backend stack for your website/web application, this is quite easy to configure. …

If you have a PHP or a Laravel based application, there was a time wondering where the users are coming from, and that’s is so important when it comes to marketing.

This is what Wikipedia says about this:

The HTTP referer is an optional HTTP header field that identifies the address of the webpage which is linked to the resource being requested. By checking the referrer, the new webpage can see where the request originated.

Here’s how you can do it in PHP without the need of any framework:

$referer = $_SERVER['HTTP_REFERER'] ?? null;echo $referer;

So how can we…

N+1 problem when requesting posts and their authors
N+1 problem when requesting posts and their authors
N+1 problem when requesting posts and their authors

As you might have used Eloquent in all of your Laravel projects you feel the comfort the Eloquent brings to your life.

Eloquent is saving tons of time from developers, but it can run into issues if you don’t take care of the queries. One of the problems that can happen is known as the N+1 problem.

What is the N+1 problem?

Let’s explain it in practice:

Suppose you have two models called User and Post.

Unit Testing
Unit Testing
Unit Testing

Let’s start with the term “unit testing”.

What is unit testing?

Wikipedia says:

In computer programming, unit testing is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use.

It might seem a bit confusing. In simple terms, unit testing is the process of writing tests for individual parts of a program. …

PHP 7.4

The PHP development team has just released the PHP 7.4.0 version on the 28th of November 2019.

This version includes several improvements and new features that we will talk about the important ones.

1. Typed Properties

Class properties now support type declarations:

class User {
public int $id;
public string $name;

As you can see, this piece of code will enforce that the $user->id can only be assigned integer values and $user->name can only be assigned string values.

2. Unpacking inside arrays

$parts = ['apple', 'pear'];
$fruits = ['banana', 'orange', ...$parts, 'watermelon'];
// ['banana', 'orange', 'apple', 'pear', 'watermelon'];

In the example above…

Decorator Design Pattern
Decorator Design Pattern
Decorator Design Pattern

What is the design pattern?

In software engineering, software design patterns are common solutions for common problems. Is it a piece of code? Of course, NOT! It could be a description or template which can be used in many different situations to solve a problem.

Some people may ask, “Why should we use them?” the answer is, “Because design patterns are both optimized and reusable.

They were generally grouped into three categories:

What is the Decorator design pattern?

To simplify the term Decorator Pattern, we can say they will allow adding new functionalities to a particular object without applying it to other objects of a…

Arman Ahmadi

Backend developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store