Technology Web Development

change PHP version

Change Global (command line) php version (for laravel):

use this command :

sudo update-alternatives --config php

for more see link below :

Change apache PHP version (for projects which you run with apache):

#(old php version)
sudo a2dismod php5 

#(new php version )
sudo a2enmod php7.1 

sudo systemctl restart apache2

Programming Technology Web Development

Pagination in laravel relation

public function get_shop_products($shop_id)
        $shop = Shop::query()
            ->where('id' , $shop_id)
        $shop->setRelation('products' , $shop->products()->paginate(10));
        return new ShopProductsResource($shop);

Masoud Hosseini

Programming Technology Useful Addresses Web Development

I love Frappe Framework

In this post, I want to write about a miracle in the software development world.

Imagine you can create your database entities with some clicks; you have many types of fields that are built in that software.

For a programmer who codes in pure PHP or python with a front-end framework, it takes more than 1 month to create a blog and shop website, but you can have all of that in one or two days with Frappe; Wow 🙂 What amazing!

You can read more about it on its official website:

I also created a GitHub repository to keep some sample script codes that during working with frappe you probably need to use.

You can have it here (don’t forget to give it a start and communicate):

Best practice devops Programming Technology Web Development

Implement Rest APIs more efficient

Most web applications are implemented based on Rest Full APIs and as I researched huge part of them are not implemented based on best practices and clean code principles, so I decided to collect some points in a couple of posts to help make them more efficient APIs and Applications.

Let’s Look at other kinds of APIs

you can easily research and find out more about all of these kine of API design methodologies but here I’m going to just collect best part of them to create a document to implement Rest API in best practice.


the best part of graphql is that you can design your API for the front end to just get whatever need, not more.

it can bring us better speed because less amount of packets is transferring over the network.



Web Development

What is Graphql

I worked many years with Rest API, and because of a special situation, I had to work with Garphql in my projects.

After working with Graphql, I shared my experience and some valuable tips here.

  • what is Graphql?
  • where need to use Graphql?
  • Graphql or Rest ?

What is Graphql?

It was always a problem in projects to communicate between back-end and front-end using Rest APIs.

By using Rest API, you need to create an endpoint for every request or format data that the frontend needs.

But, by using Graphql, you prepare an endpoint, and the frontend will get the data with every format it wants.

After this explanation, like as other resources, we can say that: Graphql is a query language for the frontend which backend is organized.

Programming Technology Web Development

Using Types in PHP is one of the least used features

Using Types in PHP is one of the least used features, but very powerful features available in PHP. This is a feature that can save you and other developers a whole lot of stress (if you work with a team).

Of course, you can write function descriptions, but it becomes quite a daunting task to write function descriptions for all your functions and variables in a large project.

When someone else wants to use your function or even you want to use it after a couple of weeks later, it needs to check the function’s body to recognize which types you should pass to the function while using, if you don’t specify arguments types.


function getItem(array $item) {
return allItems()[$item[0]];

This will make sure that whatever is passed in here is the type needed. You can read more from

For more tips: