<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mohammed Samgan Khan</title>
    <description>The latest articles on Forem by Mohammed Samgan Khan (@msamgan).</description>
    <link>https://forem.com/msamgan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F159762%2Fec18bde0-4559-4182-85dd-87bed113b56e.jpeg</url>
      <title>Forem: Mohammed Samgan Khan</title>
      <link>https://forem.com/msamgan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/msamgan"/>
    <language>en</language>
    <item>
      <title>TEST TEST TEST</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Thu, 13 Mar 2025 16:47:17 +0000</pubDate>
      <link>https://forem.com/digitalmise1/test-test-test-1fae</link>
      <guid>https://forem.com/digitalmise1/test-test-test-1fae</guid>
      <description>&lt;p&gt;TEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TEST&lt;/p&gt;

&lt;p&gt;TEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TESTTEST TEST TEST&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Contribute to Laravel: A Step-by-Step Guide</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Sun, 23 Jun 2024 02:01:16 +0000</pubDate>
      <link>https://forem.com/msamgan/how-to-contribute-to-laravel-a-step-by-step-guide-560k</link>
      <guid>https://forem.com/msamgan/how-to-contribute-to-laravel-a-step-by-step-guide-560k</guid>
      <description>&lt;p&gt;Every laravel developer has this wish to contribute to laravel, but it's hard to find a starting point on how to do that. where to start, how this, what that, all these questions and searching on the internet won't be much of a help. There are many articles on how to do laravel but almost no detailed information on how to contribute to this master framework.&lt;/p&gt;

&lt;p&gt;In this article, we will try to find out answers to some of those questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Familiarize Yourself with Laravel
&lt;/h2&gt;

&lt;p&gt;Before jumping in the contributing, I would highly recommend that you familiarize yourself with laravel. it can be done in the following three ways.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read the Documentation&lt;/li&gt;
&lt;li&gt;Build Projects&lt;/li&gt;
&lt;li&gt;Engage with the Community&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you think you have overcome the above-mentioned requirement, let's get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fork the Laravel Framework Repository
&lt;/h2&gt;

&lt;p&gt;The first step in the contribution is to fork the &lt;a href="https://github.com/laravel/framework" rel="noopener noreferrer"&gt;laravel framework repository&lt;/a&gt; in your GitHub account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs9ncyle53e8nso9mhtyu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs9ncyle53e8nso9mhtyu.png" alt="laravel fork"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pro Tip: While forking uncheck the latest release branch only check. Else you will have only the latest release branch in your account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Local Setup
&lt;/h2&gt;

&lt;p&gt;Follow the steps below to set up the workflow on your local machine.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a new Laravel project
&lt;/h3&gt;

&lt;p&gt;Create a new laravel project. You can get instructions for that from &lt;a href="https://laravel.com/docs/11.x/installation" rel="noopener noreferrer"&gt;here&lt;/a&gt;. As of this time, laravel 11 is the latest version so that will be our base for the work. Once you have the setup up and running we will start our development changes. You can also use the following command.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

composer create-project laravel/laravel laravel-app


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Clone the Fork on your machine
&lt;/h3&gt;

&lt;p&gt;Use the following command to clone the fork to your local machine&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

git clone "path to your git repository"


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Pro Tip: I suggest making the directory structure as shown in the picture below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fztc4gh3nvfrdmnvcqi4h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fztc4gh3nvfrdmnvcqi4h.png" alt="directory structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Updating the composer.json
&lt;/h2&gt;

&lt;p&gt;Once all the things are in place, update the content of composer.json with the following content.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

"minimum-stability": "dev",
"repositories": [
        {
            "type": "path",
            "url": "../laravel-framework"
        }
    ]


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After that run composer update&lt;/p&gt;

&lt;p&gt;Now you have your Laravel app using your local copy of the laravel framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a Feature or Bug Branch
&lt;/h2&gt;

&lt;p&gt;Create a &lt;a href="https://github.com/laravel/framework/issues/new/choose" rel="noopener noreferrer"&gt;new branch&lt;/a&gt; on your local machine and make the required changes. You can use the following command to create a new branch.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

git checkout -b feature/new-feature



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Once the changes are done, push the changes to your repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a new Issue and submit the PR about that issue.
&lt;/h2&gt;

&lt;p&gt;Create a &lt;a href="https://github.com/laravel/framework/issues/new/choose" rel="noopener noreferrer"&gt;new issue&lt;/a&gt; in the parent repository, in our case the &lt;a href="https://github.com/laravel/framework" rel="noopener noreferrer"&gt;laravel/framework&lt;/a&gt; repository. Be as detailed as you can be for the update you are doing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft0z2w33k95vhp026n4ux.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft0z2w33k95vhp026n4ux.png" alt="pull request"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And there we go. You have your contribution done. Ones verified by the Laravel maintainers it can move forward.&lt;/p&gt;

&lt;p&gt;Fell free to comment below in case of feedback or questions.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/fBdlp1w32TA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>opensource</category>
    </item>
    <item>
      <title>How to Cache in NodeJs APIs</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Fri, 01 Mar 2024 17:54:17 +0000</pubDate>
      <link>https://forem.com/msamgan/how-to-cache-in-nodejs-apis-1g4j</link>
      <guid>https://forem.com/msamgan/how-to-cache-in-nodejs-apis-1g4j</guid>
      <description>&lt;p&gt;Speed is what all web/mobile apps need. And with growing database size, the speed is the first thing that takes a hit. Comes cache to rescue.&lt;/p&gt;

&lt;p&gt;A cache can be defined as storing data in RAM for quick access (faster than getting data from DB), also we can store the results for regular calculations in the cache to save time on recalculation again and again.&lt;/p&gt;

&lt;p&gt;There are various types of available caches, you can research that for a more detailed understanding. We will not cover that in the scope of this article.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to implement cache
&lt;/h2&gt;

&lt;p&gt;Implementing a cache is more or less a kind of art, depending on your requirements and available methodologies. What I prefer is using Redis for cache. It's easy to use, fast and reliable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Usage&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { createClient } = require("redis")

const  cacheing = async () =&amp;gt; {
    let redisConfig = {
        host: "localhost",
        port: 6379,
        username: "",
        password: "",
        database: 0
    }

    const client = createClient(redisConfig)

    client.on("error", (err) =&amp;gt; console.log("Redis Client Error", err))
    await client.connect()

    // setting cache
    await client.set("key", "string_value")

    // getting cache
    const value = await client.get("key");
    //If the key does not exist, the value will be null
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  OR
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;or you can use Framework X (AKA Fx). Which comes with a supper charges cache in build. Fx cache not only caches your data but also updates the cached data in a given duration so that your cache never goes out of new data, checking when the given data was accessed. AND all this with an implementation time of less than a min.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To Know about how to get started with Fx, &lt;a href="https://codebysamgan.com/how-to-create-rest-api-in-nodejs" rel="noopener noreferrer"&gt;please follow this link.&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once up and running, you can use the cache as follows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { setCache, getCache } = require("@3rdplanet/x-core/cache")

exports.index = async (req, res) =&amp;gt; {
    let responseData = await getCache(req.url)

    if (responseData) {
        return res.send(successResponse("cache found...", responseData.response))
    }

    let someCalculationAnswer = someCalculations(1, 1, 1)

    setCache(req.url, someCalculationAnswer, {
        function: someCalculations,
        params: [1, 1, 1]
    }).then(() =&amp;gt; {})

    return res.send(successResponse("cache in progress...", someCalculationAnswer))
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, you will need to add the following keys in your .env file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CACHE_UPDATE_INTERVAL - The interval in seconds to update the cache. The default is 10 seconds.&lt;/li&gt;
&lt;li&gt;CACHE_EXPIRE_TIME - The time in seconds to expire the cache. The default is 60 seconds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can learn more about &lt;a href="https://www.frameworkx.info/docs/overview/cache" rel="noopener noreferrer"&gt;Fx cache here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to ask questions in the comments if you have any sort of doubts or queries.&lt;/p&gt;

</description>
      <category>node</category>
      <category>api</category>
      <category>express</category>
      <category>frameworkx</category>
    </item>
    <item>
      <title>How to create REST API in NodeJs</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Mon, 26 Feb 2024 16:46:39 +0000</pubDate>
      <link>https://forem.com/msamgan/how-to-create-rest-api-in-nodejs-1i23</link>
      <guid>https://forem.com/msamgan/how-to-create-rest-api-in-nodejs-1i23</guid>
      <description>&lt;p&gt;APIs are one of the most vital parts of any web or mobile application. I am assuming that you are already familiar with the concept of API, what they are, and what they do. Yet, just for the same of this article let me define what an API is.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;APIs are mechanisms that enable two software components to communicate with each other using a set of definitions and protocols. For example, the weather bureau’s software system contains daily weather data. The weather app on your phone “talks” to this system via APIs and shows you daily weather updates on your phone.&lt;/p&gt;

&lt;p&gt;source: &lt;a href="https://aws.amazon.com/what-is/api/" rel="noopener noreferrer"&gt;https://aws.amazon.com/what-is/api/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Since we have an overview of what APIs are, let's dive into the "How" of the process.&lt;/p&gt;

&lt;p&gt;We will use &lt;a href="https://www.frameworkx.info/" rel="noopener noreferrer"&gt;Framework X&lt;/a&gt; for creating the API in Node Js.&lt;/p&gt;

&lt;p&gt;Framework X or Fx is a new NodeJs framework based on express. Fx provides you with everything you need to get started with your APIs. Fx just does not stop at being a starter kit, it has all the what you need to scale your application. The best part is that it's created for the developer by the developers focusing on ease and speed of development.&lt;/p&gt;

&lt;p&gt;You can get more details about Fx, here: &lt;a href="https://www.frameworkx.info/" rel="noopener noreferrer"&gt;https://www.frameworkx.info/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;Getting started is as easy as running this command. (make sure you have node installed.)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @3rdplanet/framework-x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Answer the question asked while installing. and you are good to go. Everything you need is already installed, and up and running. Refer to the documentation for details, it's straightforward, simple, and easy to understand.&lt;/p&gt;

&lt;p&gt;Feel free to ask questions in the comments if you have any sort of doubts or queries.&lt;/p&gt;

</description>
      <category>node</category>
      <category>express</category>
      <category>api</category>
      <category>frameworkx</category>
    </item>
    <item>
      <title>I just enabled TS support in the framework I am working on, should I stop?</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Fri, 08 Sep 2023 19:49:45 +0000</pubDate>
      <link>https://forem.com/msamgan/i-just-enabled-ts-support-in-the-framework-i-am-working-on-should-i-stop-jh4</link>
      <guid>https://forem.com/msamgan/i-just-enabled-ts-support-in-the-framework-i-am-working-on-should-i-stop-jh4</guid>
      <description>&lt;p&gt;hi,&lt;/p&gt;

&lt;p&gt;I am working on an open-source NodeJs Framework, &lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/3rd-planet/framework-x" rel="noopener noreferrer"&gt;https://github.com/3rd-planet/framework-x&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I just enabled the TS support for it and planned to create every feature in both JS and TS. But, now there is an ongoing debate over the dropping of TS by some big giants. What should I do? Ignore the debate and keep on going or I should drop TS too?&lt;/p&gt;

&lt;p&gt;Your suggestion will be appreciated.&lt;/p&gt;

</description>
      <category>node</category>
      <category>typescript</category>
      <category>javascript</category>
      <category>framework</category>
    </item>
    <item>
      <title>How to check all ports in use in linux/Mac</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Thu, 10 Aug 2023 21:10:36 +0000</pubDate>
      <link>https://forem.com/msamgan/how-to-check-all-ports-in-use-in-linuxmac-46ig</link>
      <guid>https://forem.com/msamgan/how-to-check-all-ports-in-use-in-linuxmac-46ig</guid>
      <description>&lt;p&gt;When you work with NodeJS and micro-service architecture by the end of the day there are a number of ports which you start using.&lt;/p&gt;

&lt;p&gt;To check which port is already in use, use the following command.&lt;/p&gt;

&lt;h2&gt;
  
  
  For Linux
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;netstat -lnp | grep node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;-l: Show only listening ports.&lt;/li&gt;
&lt;li&gt;-n: Show numerical addresses instead of resolving hostnames.&lt;/li&gt;
&lt;li&gt;-p: show type of port (grep works on this)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ss -tuln
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;-t: Show TCP ports.&lt;/li&gt;
&lt;li&gt;-u: Show UDP ports.&lt;/li&gt;
&lt;li&gt;-l: Show only listening ports.&lt;/li&gt;
&lt;li&gt;-n: Show numerical addresses instead of resolving hostnames.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lsof -i -n -P | grep node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;i: Specifies that you're interested in network-related information, specifically open network connections and listening sockets.&lt;/li&gt;
&lt;li&gt;-n: Prevents lsof from attempting to resolve IP addresses to hostnames. Shows numerical IP addresses instead.&lt;/li&gt;
&lt;li&gt;-P: Prevents lsof from resolving port numbers to service names. Shows numerical port numbers instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  For Mac
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lsof -i -n -P | grep node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;i: Specifies that you're interested in network-related information, specifically open network connections and listening sockets.&lt;/li&gt;
&lt;li&gt;-n: Prevents lsof from attempting to resolve IP addresses to hostnames. Shows numerical IP addresses instead.&lt;/li&gt;
&lt;li&gt;-P: Prevents lsof from resolving port numbers to service names. Shows numerical port numbers instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, you can use graphical tools like lsof and network monitoring tools like nmap for more advanced analysis of open ports and network connections.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>macos</category>
      <category>node</category>
    </item>
    <item>
      <title>How to create and use a custom middleware in laravel 10</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Wed, 09 Aug 2023 21:47:19 +0000</pubDate>
      <link>https://forem.com/msamgan/how-to-create-and-use-a-custom-middleware-in-laravel-10-2b6j</link>
      <guid>https://forem.com/msamgan/how-to-create-and-use-a-custom-middleware-in-laravel-10-2b6j</guid>
      <description>&lt;p&gt;Creating a custom middleware in Laravel is a good way to add custom logic to the request-response cycle. Laravel itself use a number of middleware for specific tasks. Middleware can be used for tasks ranging from authentication, authorization, logging to tasks like adding data to request etc. etc. etc..&lt;/p&gt;

&lt;p&gt;Below is a step-by-step guide showing how to create a middleware in laravel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create the Middleware
&lt;/h2&gt;

&lt;p&gt;To create a middleware use the following command in your terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:middleware CustomMiddleware
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will create a new middleware file named CustomMiddleware.php in the app/Http/Middleware directory.&lt;/p&gt;

&lt;p&gt;The file create will look something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

class CustomMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param Closure(Request): (Response) $next
     */
    public function handle(Request $request, Closure $next): Response
    {
        return $next($request);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Update the Middleware
&lt;/h2&gt;

&lt;p&gt;The entire logic goes in the handle function. You can modify the request, perform checks, and take actions based on the conditions you define.&lt;/p&gt;

&lt;h2&gt;
  
  
  Register the Middleware
&lt;/h2&gt;

&lt;p&gt;To make your middleware functional, you need to register it in Laravel's middleware stack. Open the app/Http/Kernel.php file and locate the $middleware array. Add an entry for your custom middleware class. Make sure you use the complete file path of the middleware.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;protected $middleware = [
    // Other middleware entries
    \App\Http\Middleware\CustomMiddleware::class,
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: if you will add the entry to $middleware array, your middleware will be applied on all the request through out the application. Including web and api. Add to $middlewareGroups.web for web requests only and $middlewareGroups.api for api requests only.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Applying the Middleware
&lt;/h2&gt;

&lt;p&gt;Now this middleware can be applied to routes or route groups.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::get('/example', 'ExampleController@index')-&amp;gt;middleware('custom')-&amp;gt;name('example');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the custom middleware will be applied to the example route.&lt;/p&gt;

&lt;p&gt;For more details you can always refer to the Laravel documentation for the most up-to-date information and additional middleware options. &lt;a href="https://laravel.com/docs/8.x/middleware" rel="noopener noreferrer"&gt;Laravel Middleware Documentation&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>middleware</category>
      <category>php</category>
    </item>
    <item>
      <title>Python script to run multiple servers simultaneously on a local machine on Mac.</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Tue, 26 Jul 2022 19:33:00 +0000</pubDate>
      <link>https://forem.com/msamgan/python-script-to-run-multiple-servers-simultaneously-on-a-local-machine-on-mac-342h</link>
      <guid>https://forem.com/msamgan/python-script-to-run-multiple-servers-simultaneously-on-a-local-machine-on-mac-342h</guid>
      <description>&lt;p&gt;There are a number of times we have a bunch of servers we need to run to fully run an application, yes i am talking about the microservice arch. It's annoying to go to each repo and get the server running. Below is the script for making it automated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="c1"&gt;#!/usr/bin/python3
&lt;/span&gt;
&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
Script that starts the servers from the &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;services&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; array.
services = [
  {
    &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;service_name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;,
    &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;path&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;path_to_service&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;,
    &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;command&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;command_to_run&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;,
  },
&lt;/span&gt;&lt;span class="gp"&gt;  ...&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;single&lt;/span&gt; &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;please&lt;/span&gt; &lt;span class="k"&gt;pass&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="bp"&gt;...&lt;/span&gt;
&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;msamgan&lt;/span&gt;
&lt;span class="n"&gt;created&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2022&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;05&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;01&lt;/span&gt;
&lt;span class="n"&gt;updated&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2022&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;07&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;
&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="n"&gt;signature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;service_name&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="sh"&gt;"""&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;

&lt;span class="n"&gt;services&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;

&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# uncomment if on mac os..
# os.system("say 'booting shopini servers'")
&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;system&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sleep 1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;serverCommand&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;

    &lt;span class="c1"&gt;# say = "say 'booting " + service["name"] + " server'"
&lt;/span&gt;    &lt;span class="c1"&gt;# os.system(say)
&lt;/span&gt;    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;system&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ttab.sh -w -t &lt;/span&gt;&lt;span class="sh"&gt;'"&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"'&lt;/span&gt;&lt;span class="s"&gt; -d &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;path&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;command&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# os.system(
#     "say 'all shopini servers are running at there full potentials, have a nice day!'"
# )
# kill command: kill -9 $(lsof -ti:5100)
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://github.com/mklement0/ttab" rel="noopener noreferrer"&gt;ttab.sh library you will need&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>automatio</category>
      <category>microservices</category>
    </item>
    <item>
      <title>function to round up a float number to next point five like 3.3 to 3.5, 3.8 to 4</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Tue, 26 Jul 2022 19:17:11 +0000</pubDate>
      <link>https://forem.com/msamgan/function-to-round-up-a-float-number-to-next-point-five-like-33-to-35-38-to-4-108p</link>
      <guid>https://forem.com/msamgan/function-to-round-up-a-float-number-to-next-point-five-like-33-to-35-38-to-4-108p</guid>
      <description>&lt;p&gt;If you are from the shipping industry you face this problem a lot of time where you charge per 0.5 kg. In this kind of case, you need to make the weight from float to round up.&lt;/p&gt;

&lt;p&gt;here is a php function to achieve that.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


</description>
      <category>php</category>
      <category>functional</category>
    </item>
    <item>
      <title>How to Add Laravel Pint to VS Code Formatter</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Fri, 24 Jun 2022 19:20:40 +0000</pubDate>
      <link>https://forem.com/msamgan/how-to-add-laravel-pint-to-vs-code-formatter-4nho</link>
      <guid>https://forem.com/msamgan/how-to-add-laravel-pint-to-vs-code-formatter-4nho</guid>
      <description>&lt;h2&gt;
  
  
  What is laravel pint
&lt;/h2&gt;

&lt;p&gt;as in the defination by the official repository,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Laravel Pint is an opinionated PHP code style fixer for minimalists. Pint is built on top of PHP-CS-Fixer and makes it simple to ensure that your code style stays clean and consistent.&lt;br&gt;
-- laravel/pint&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and as per me, Pint is the so far most sophisticated code formatter i have ever user in the reference of PHP. You can find more details about &lt;a href="https://github.com/laravel/pint" rel="noopener noreferrer"&gt;laravel/pint here.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="n"&gt;composer&lt;/span&gt; &lt;span class="k"&gt;require&lt;/span&gt; &lt;span class="n"&gt;laravel&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;pint&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  General Usage
&lt;/h2&gt;

&lt;p&gt;to use the pint binary all you have to do is run the following command in the root of you laravel project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;vendor&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;pint&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configuration
&lt;/h2&gt;

&lt;p&gt;The default setup of laravel pint does not require any configuration and as per the official docs, it for PSR-12 Style Guide. Still if you are unhappy with some default rules you can change then by creating a pint.json in root of your project, and adding the preset to it.&lt;/p&gt;

&lt;p&gt;Currently the following preset are supported&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;psr12&lt;/li&gt;
&lt;li&gt;laravel&lt;/li&gt;
&lt;li&gt;symfony&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Since Pint is based on PHP-CS-Fixer the configuration rules can be found &lt;a href="https://mlocati.github.io/php-cs-fixer-configurator/#version:3.8" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sample pint.json
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"preset"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"symfony"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"rules"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"concat_space"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"spacing"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"one"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Binding laravel pint with VS Code
&lt;/h2&gt;

&lt;p&gt;So far we are good to use laravel/pint, but opening terminal and running a binary everytime you need to format id one hell of a job. To reduce that effort we will bind laravel/pint with our VS Code with the help of VS Code Task&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating VS Code task for laravel pint
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;To create a task create a &lt;code&gt;.vscode directory in root&lt;/code&gt;of you project, if you don't have one.&lt;/li&gt;
&lt;li&gt;Add a &lt;code&gt;new file named as tasks.json&lt;/code&gt; to .vscode directory&lt;/li&gt;
&lt;li&gt;add the following content to the new created file
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"tasks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Pint Formatter"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./vendor/bin/pint"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"problemMatcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"presentation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"reveal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"silent"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"group"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"kind"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"isDefault"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can run this task directly from the &lt;code&gt;Tremial -&amp;gt; Run Tasks&lt;/code&gt; from the navigation, but will do it a bit more simpler.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding KeyBinding (Keyboard Shortcut) to Run laravel pint
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open Keyboard shortcut panel, either from &lt;code&gt;file -&amp;gt; preferences -&amp;gt; keyboard Shortcuts&lt;/code&gt; or &lt;code&gt;Ctrl+k Ctrl+s&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Ones open click on the file icon on the top to open the json file of the keyboard shortcuts.&lt;/li&gt;
&lt;li&gt;Ones open add the following lines to the file.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ctrl+shift+l"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"workbench.action.tasks.runTask"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Pint Formatter"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now all you have to do is hit &lt;code&gt;Ctrl + Shift + l&lt;/code&gt; and your laravel project will formatted with laravel pint.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Extension
&lt;/h2&gt;

&lt;p&gt;If you are more driven toward the extension approach you can get the above integration by using the following extension.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=msamgan.laravel-pint-vscode&amp;amp;ssr=false#overview" rel="noopener noreferrer"&gt;Vscode Laravel Pint Extension&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/msamgan/vscode-larapint" rel="noopener noreferrer"&gt;show some support bby staring the repo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I have been using the unsatisfactory formatters from a long time. All of them have one thing but lack other. Laravel Pint is one who has it all, combining it with vscode is like proving you laravel project a super power.&lt;/p&gt;

&lt;p&gt;Feel free to pick your brain in comments.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>laravelpint</category>
      <category>vscode</category>
      <category>formatter</category>
    </item>
    <item>
      <title>How to Add AppImage Application to Menu in Ubuntu (Linux)</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Wed, 22 Jun 2022 09:29:01 +0000</pubDate>
      <link>https://forem.com/msamgan/how-to-add-appimage-application-to-menu-in-ubuntu-linux-8o2</link>
      <guid>https://forem.com/msamgan/how-to-add-appimage-application-to-menu-in-ubuntu-linux-8o2</guid>
      <description>&lt;p&gt;AppImages are the easiest to run compared. All you need to do is follow the steps mentioned below. &lt;/p&gt;

&lt;h2&gt;
  
  
  Step to use AppImage
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Download the AppImage&lt;/li&gt;
&lt;li&gt;Make the AppImage executable. (sudo chmod +x *.AppImage)&lt;/li&gt;
&lt;li&gt;Run the file (./*.AppImage)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The challenging task is to make the &lt;strong&gt;AppImage accessible globally through he system like an installed application&lt;/strong&gt; (in the menu)&lt;/p&gt;

&lt;p&gt;you can achieve this by going through the following steps. &lt;/p&gt;

&lt;p&gt;The remaining article is originally posted at...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://msamgan.com/how-to-add-appimage-application-to-menu-in-ubuntu-linux" rel="noopener noreferrer"&gt;https://msamgan.com/how-to-add-appimage-application-to-menu-in-ubuntu-linux&lt;/a&gt;&lt;/p&gt;

</description>
      <category>appimage</category>
      <category>linux</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>create-express-boilerplate to create new API projects in a secs</title>
      <dc:creator>Mohammed Samgan Khan</dc:creator>
      <pubDate>Thu, 27 Jan 2022 19:54:49 +0000</pubDate>
      <link>https://forem.com/msamgan/create-express-boilerplate-to-create-new-api-projects-in-a-secs-4550</link>
      <guid>https://forem.com/msamgan/create-express-boilerplate-to-create-new-api-projects-in-a-secs-4550</guid>
      <description>&lt;p&gt;Initiating a new project is as exciting as frustrating. Going through all the routine work just to get the basic engine started, yaa I know the pain.&lt;/p&gt;

&lt;h2&gt;
  
  
  create-express-boilerplate to Rescue
&lt;/h2&gt;

&lt;p&gt;I along with the tremendous help of &lt;a href="https://github.com/hudaQeshta" rel="noopener noreferrer"&gt;huda&lt;/a&gt; worked out the solution for you, in the form of create-express-boilerplate. It includes&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Entire expressjs setup&lt;/li&gt;
&lt;li&gt;Validation Integration with &lt;a href="https://express-validator.github.io/docs/" rel="noopener noreferrer"&gt;express-validator&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Directory setups to provide you with less headache for where goes what&lt;/li&gt;
&lt;li&gt;MVC architecture&lt;/li&gt;
&lt;li&gt;DB support for both&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://sequelize.org/" rel="noopener noreferrer"&gt;Sequelize&lt;/a&gt; (MySQL and SQLite)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://mongoosejs.com/" rel="noopener noreferrer"&gt;Mongoose&lt;/a&gt; (mongoDB)&lt;/li&gt;
&lt;li&gt;Integrated &lt;a href="https://jestjs.io/" rel="noopener noreferrer"&gt;JEST test Suite&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Both Vanilla JS and Typescript support&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://typicode.github.io/husky/#/" rel="noopener noreferrer"&gt;Husky&lt;/a&gt; Support for pre-commit hooks&lt;/li&gt;
&lt;li&gt;Great amount of inbuild helper functions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And many more to come..&lt;/p&gt;

&lt;p&gt;you can install the setup by running&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-express-boilerplate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can have complete &lt;a href="https://create-express-boilerplate.com/" rel="noopener noreferrer"&gt;Documentation Here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;feel free to provide us with your review and feedback in the form of comments or issues on &lt;a href="https://github.com/msamgan/expressjs-api-boilerplate" rel="noopener noreferrer"&gt;github&lt;/a&gt;. All your contributions are cardinally welcome.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
