<?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: Stephen Jude</title>
    <description>The latest articles on Forem by Stephen Jude (@stephenjude).</description>
    <link>https://forem.com/stephenjude</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%2F37327%2F499d53b3-d2cd-491f-82ca-614922f79c0e.jpg</url>
      <title>Forem: Stephen Jude</title>
      <link>https://forem.com/stephenjude</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/stephenjude"/>
    <language>en</language>
    <item>
      <title>How To Set Up Auto Deploy For Laravel Applications On Cpanel</title>
      <dc:creator>Stephen Jude</dc:creator>
      <pubDate>Thu, 28 Sep 2023 07:27:00 +0000</pubDate>
      <link>https://forem.com/stephenjude/how-to-set-up-auto-deploy-for-laravel-applications-on-cpanel-ni0</link>
      <guid>https://forem.com/stephenjude/how-to-set-up-auto-deploy-for-laravel-applications-on-cpanel-ni0</guid>
      <description>&lt;p&gt;In this post, I will show you how to set up auto for your Laravel application on Cpanel. I want to assume you already have your Laravel app deployed on CPanel, and your version control provider(Github, Gitlab, or Bitbucket) connected to the Cpanel server. If you haven't, please check out my previous posts below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://stephenjude.me/articles/run-composer-php-commands-on-cpanel-terminal-using-any-php-cli-version-installed-centos-cloudlinux" rel="noopener noreferrer"&gt;Run Composer &amp;amp; PHP Commands On Cpanel Terminal Using Any PHP CLI Version Installed — CentOS &amp;amp; CloudLinux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stephenjude.me/articles/how-to-connect-cpanel-to-github-gitlab-and-bitbucket-and-deploy-private-repositories" rel="noopener noreferrer"&gt;How To Connect Cpanel To Github, Gitlab, And Bitbucket And Deploy Private Repositories&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stephenjude.me/articles/how-to-deploy-a-laravel-project-on-linux-shared-hosting-in-5-minutes" rel="noopener noreferrer"&gt;How To Deploy A Laravel Project On Linux Shared Hosting In 5 Minutes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Setup Deployment Script
&lt;/h3&gt;

&lt;p&gt;We need to create a &lt;code&gt;deploy.sh&lt;/code&gt; bash script inside the &lt;code&gt;public_html&lt;/code&gt; directory of our CPanel and paste the code snippet below.&lt;/p&gt;

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

&lt;span class="c"&gt;#!/bin/sh&lt;/span&gt;

&lt;span class="c"&gt;# Change to the project directory. &lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/path/to/project

&lt;span class="c"&gt;# Pull the latest changes from the git repository&lt;/span&gt;
git pull origin main

&lt;span class="c"&gt;# Install/update composer dependencies&lt;/span&gt;
composer &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--no-interaction&lt;/span&gt;

&lt;span class="c"&gt;# Run database migrations&lt;/span&gt;
php artisan migrate &lt;span class="nt"&gt;--force&lt;/span&gt;

&lt;span class="c"&gt;# Clear caches&lt;/span&gt;
php artisan cache:clear

&lt;span class="c"&gt;# Clear and cache routes&lt;/span&gt;
php artisan route:cache

&lt;span class="c"&gt;# Clear and cache config&lt;/span&gt;
php artisan config:cache

&lt;span class="c"&gt;# Clear and cache views&lt;/span&gt;
php artisan view:cache



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

&lt;/div&gt;

&lt;p&gt;The code snippet above when executed, will then change to the project directory and pull the latest changes, install composer dependencies, and other necessary artisan commands for our Laravel application. &lt;/p&gt;

&lt;p&gt;Let's make the &lt;code&gt;deploy.sh&lt;/code&gt; bash script executable by running the command below on our CPanel terminal.&lt;/p&gt;

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

&lt;span class="nb"&gt;chmod&lt;/span&gt; +x ~/public_html/deploy.sh


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

&lt;/div&gt;

&lt;p&gt;We can manually change the bash script file permission using CPanel file permission dialog.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstephenjude.me%2Fassets%2Fimages%2Fposts%2Fscript-permission.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%2Fstephenjude.me%2Fassets%2Fimages%2Fposts%2Fscript-permission.png" alt="Cpanel File Permisson Dialog"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Setup Cpanel Webhook
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a Cpanel subdomain like this: &lt;code&gt;webhook.yourdomain.com&lt;/code&gt; or whatever works for you.&lt;/li&gt;
&lt;li&gt;Create an &lt;code&gt;index.php&lt;/code&gt; file inside the subdomain directory &lt;code&gt;~/public_html/webhook.yourdomain.com&lt;/code&gt; and paste the code snippet below: &lt;/li&gt;
&lt;/ul&gt;

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

&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="c1"&gt;// Execute deploy script&lt;/span&gt;
&lt;span class="nv"&gt;$output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;shell_exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'. ~/public_html/deploy.sh'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Send back execution output to the webhook originator.&lt;/span&gt;
&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$output&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 

&lt;span class="c1"&gt;// Return OK response&lt;/span&gt;
&lt;span class="nb"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"HTTP/1.1 200 OK"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;This PHP script will execute our bash script, echo the output, and return 200 HTTP responses. You can test this by making an HTTP request to this subdomain using any HTTP client of your choice. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If your subdomain is returning error 500, create a &lt;code&gt;.htaccess&lt;/code&gt; file inside the subdomain root directory and paste the code snippet below:&lt;/p&gt;
&lt;/blockquote&gt;


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

&lt;p&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&lt;br&gt;
    RewriteEngine On&lt;br&gt;
&amp;lt;/IfModule&amp;gt;&lt;/p&gt;

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

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Github, Gitlab &amp;amp; Bitbucket Setup&lt;br&gt;
&lt;/h3&gt;

&lt;p&gt;Navigate to the webhook settings of your repository and add your cpanel webhook URL(&lt;a href="https://webhook.yourdomain.com/" rel="noopener noreferrer"&gt;https://webhook.yourdomain.com/&lt;/a&gt;) for push events. You can test this out by adding a commit to your code repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bonus:
&lt;/h3&gt;

&lt;p&gt;If you are using Github, you can check your webhook logs under &lt;code&gt;Recent Deliveries&lt;/code&gt; tab in your repository webhook settings. You will see a log of all the webhook requests that have been sent to your Cpanel server. The same applies to Bitbucket but not Gitlab.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>cpanel</category>
    </item>
    <item>
      <title>How To Setup A Custom Artisan Command And Calculate The Execution Time</title>
      <dc:creator>Stephen Jude</dc:creator>
      <pubDate>Mon, 29 Jun 2020 21:01:02 +0000</pubDate>
      <link>https://forem.com/stephenjude/how-to-setup-a-custom-artisan-command-and-calculate-the-execution-time-1eae</link>
      <guid>https://forem.com/stephenjude/how-to-setup-a-custom-artisan-command-and-calculate-the-execution-time-1eae</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vHO-TPfr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/600/1%2ASagjVmyLJejjGdjEK0WLJg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vHO-TPfr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/600/1%2ASagjVmyLJejjGdjEK0WLJg.png" alt="" width="600" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The CLI( Command Line Interface) is one of the best places to execute a long long-running task and Laravel has provided us with the Artisan Console that allows us to create our custom commands. I usually set up custom artisan commands whenever I am building something that requires initial setup or when I want to run queries on a large DB.&lt;/p&gt;

&lt;p&gt;In this tutorial, I am going to show you how to set up a custom Artisan command and how to calculate the execution time of that command.&lt;/p&gt;

&lt;p&gt;There are two ways to create a custom Artisan Console command, the Class-Based Command and the Closure Based Command.&lt;/p&gt;

&lt;p&gt;The class base command will require us to set up a class for our artisan command (this class can be generated with the Artisan make:command). These custom command classes reside in the app/Console/Commands directory of your Laravel application.&lt;/p&gt;

&lt;p&gt;The Closure-Based Command resides inside the routes/console.php files in your Laravel application.&lt;/p&gt;

&lt;p&gt;For this tutorial, we will use the Closure Based Command.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating Custom Command
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;//routes/console.php&lt;/span&gt;
&lt;span class="err"&gt;﻿&lt;/span&gt;&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Http\Controllers\UserController&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Support\Facades\Artisan&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;Artisan&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'send:emails'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Processing'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;app&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;UserController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;sendEmails&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Processed'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a closure based commands that send out emails. Add this to the console.php file in the routes directory of your laravel application.&lt;/p&gt;

&lt;p&gt;Now we can run artisan send:email.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan send:emails
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Custom Commands With Arguments
&lt;/h3&gt;

&lt;p&gt;Something you might need to accept CLI arguments for your custom command. This is very simple with Laravel. The same way we define route arguments is how we do it for a custom command.&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="nc"&gt;Artisan&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'send:emails {type} {delay}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$delay&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Processing'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;app&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;UserController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;sendEmails&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$delay&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Processed'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The arguments are enclosed with curly brackets and passed to the closure by type-hinting as the closure function parameters.&lt;/p&gt;

&lt;p&gt;Running the command will now require we pass the email $type and the also a $delay .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan send:emails active 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Calculating Execution Time
&lt;/h3&gt;

&lt;p&gt;To calculate the execution time of a custom command we can leverage the Laravel now() &lt;a href="https://laravel.com/docs/7.x/helpers#method-now"&gt;helper method&lt;/a&gt;. The now() helper returns an instance of Carbon, now we can leverage the diffInSeconds() or diffInMinutes() methods depending on what you want to return.&lt;/p&gt;

&lt;p&gt;First, we have to define the start time and calculate the difference between the start and end time of the execution.&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="c1"&gt;//routes/console.php&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Http\Controllers\UserController&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Support\Facades\Artisan&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;Artisan&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'send:emails'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="nv"&gt;$start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Processing'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;app&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;UserController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;sendEmails&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nv"&gt;$time&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$start&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;diffInSeconds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
  &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Processed in &lt;/span&gt;&lt;span class="nv"&gt;$time&lt;/span&gt;&lt;span class="s2"&gt; seconds"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is a sample output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9AxctSB4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/832/0%2Ay7ERSQDHvULYNjUi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9AxctSB4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/832/0%2Ay7ERSQDHvULYNjUi.png" alt="" width="800" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you know about the custom artisan command, you can now move your initial setup actions or long-running tasks that are in your Laravel applications to the console.&lt;/p&gt;

&lt;p&gt;Join my &lt;a href="https://stephenjude.me/newsletter"&gt;mailing list&lt;/a&gt; and follow me on &lt;a href="https://twitter.com/stephenjudeso"&gt;twitter&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>artisan</category>
      <category>console</category>
    </item>
    <item>
      <title>Laravel Lessons: Getting Started</title>
      <dc:creator>Stephen Jude</dc:creator>
      <pubDate>Sun, 28 Jun 2020 19:44:16 +0000</pubDate>
      <link>https://forem.com/stephenjude/laravel-lessons-getting-started-1pg</link>
      <guid>https://forem.com/stephenjude/laravel-lessons-getting-started-1pg</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This article was initially sent as a mail. I had to publish it so that others who didn’t subscribe to the blog series mailing list can follow along.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;First, my name is &lt;a href="https://twitter.com/stephenjudeso"&gt;Stephen Jude&lt;/a&gt; and I have been a PHP/Laravel developer for three(3) years now.&lt;/p&gt;

&lt;p&gt;The first thing you have to know is that Laravel is a PHP framework. So everything we are going to be talking about is going to be revolving around PHP(don’t worry, you will be fine).&lt;/p&gt;

&lt;p&gt;Now let me walk you through what you are going to need for this series.&lt;/p&gt;

&lt;h3&gt;
  
  
  Development Environment
&lt;/h3&gt;

&lt;p&gt;If you have been a PHP developer, you already know about XAMPP, WAMP, LAMP and MAMP. But there is more to setting up a Laravel development environment. Laravel is made up of PHP packages(lots of them) which requires a lot of PHP extensions that also requires lots of configurations. The good news is that all these configurations have been taken care of.​&lt;/p&gt;

&lt;p&gt;If you are using Windows like me, just install &lt;a href="https://laragon.org/download/"&gt;Laragon&lt;/a&gt;. Laragon is a fast and easy way to create an isolated dev environment on Windows. Includes Mysql, PHP Memcached, Redis, Apache and Nginx.​&lt;/p&gt;

&lt;p&gt;For Linux or Mac, I recommend &lt;a href="https://laravel.com/docs/master/homestead"&gt;Laravel Homestead&lt;/a&gt;, an official pre-packaged &lt;a href="https://www.vagrantup.com/docs/installation/"&gt;Vagrant&lt;/a&gt; box that provides you with a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine.&lt;/p&gt;

&lt;p&gt;After trying &lt;a href="https://laravel.com/docs/7.x/valet"&gt;Laravel Valet&lt;/a&gt; on my new Mac Book, I will like to recommend it. It’s quite cool.&lt;/p&gt;

&lt;h3&gt;
  
  
  PHPSANDBOX.io
&lt;/h3&gt;

&lt;p&gt;If you are not ready to set up anything on your local machine, &lt;a href="https://phpsandbox.io/"&gt;PHPSandbox&lt;/a&gt;is an option for you. Its a playground for PHP and Laravel developer. Just login with your GitHub account and you are good to go. I will be sharing some of my code from there. Thanks to &lt;a href="https://twitter.com/bosunski"&gt;@Bosunki&lt;/a&gt; and his team for this awesome project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic OOP Concept In PHP
&lt;/h3&gt;

&lt;p&gt;An understanding of Object-Oriented Programming in PHP is a big plus for this Laravel series. Forget about the jargon you will see on google about OOP. Just know you will be dealing with &lt;strong&gt;classes&lt;/strong&gt; instead of the traditional &lt;strong&gt;functions&lt;/strong&gt; you are already used to.&lt;/p&gt;

&lt;p&gt;Check out w3school OOP PHP &lt;a href="https://www.w3schools.com/php/php_oop_what_is.asp"&gt;tutorial&lt;/a&gt;. If you are a visual learner, check out this &lt;a href="https://www.youtube.com/watch?v=dQxuYRNbL_M"&gt;crash course&lt;/a&gt; by Traversy Media.&lt;/p&gt;

&lt;h3&gt;
  
  
  Road Map​
&lt;/h3&gt;

&lt;p&gt;​Here are the things we are going to be covering in this series:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://stephenjude.me/articles/laravel-lessons-installation-setup"&gt;Installation &amp;amp; set up&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stephenjude.me/articles/laravel-lessons-routing"&gt;Routing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stephenjude.me/articles/laravel-lessons-layouts-views"&gt;Layouts &amp;amp; Views&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stephenjude.me/articles/laravel-lesson-controllers-requests-validations"&gt;Controllers, Requests &amp;amp; Validations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stephenjude.me/articles/laravel-lessons-database-migrations-and-eloquent-models"&gt;Database (Migrations And Eloquent Models)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stephenjude.me/articles/laravel-lessons-hosting-deployment-error-tracking"&gt;Hosting, Deployments &amp;amp; Error Tracking&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ​Questions
&lt;/h3&gt;

&lt;p&gt;I know you have lots of questions about Laravel. Feel free to send me a DM on &lt;a href="https://twitter.com/stephenjudeso"&gt;twitter( &lt;strong&gt;@stephenjudeso&lt;/strong&gt; )&lt;/a&gt; or send a mail via &lt;a href="http://hello@stephenjude.me"&gt;&lt;strong&gt;hello@stephenjude.me&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>laraveleloquent</category>
      <category>bladelayouts</category>
    </item>
    <item>
      <title>Getting Started With PHPSandbox.io — An Online Code Sandbox For PHP</title>
      <dc:creator>Stephen Jude</dc:creator>
      <pubDate>Sun, 19 Apr 2020 16:40:12 +0000</pubDate>
      <link>https://forem.com/stephenjude/getting-started-with-phpsandbox-io-an-online-code-sandbox-for-php-43kc</link>
      <guid>https://forem.com/stephenjude/getting-started-with-phpsandbox-io-an-online-code-sandbox-for-php-43kc</guid>
      <description>&lt;h3&gt;
  
  
  Getting Started With PHPSandbox.io — An Online Code Sandbox For PHP
&lt;/h3&gt;

&lt;p&gt;Last week I sent out a getting started mail to everyone following my &lt;a href="https://bit.ly/laravel-lessons"&gt;Laravel series&lt;/a&gt; for beginners. I mentioned &lt;a href="https://phpsandbox.io/"&gt;PHPSandbox.io&lt;/a&gt; for those who don’t want to setup a local development environment.&lt;/p&gt;

&lt;p&gt;So whats this PHPSandbox all about?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vTudIA7y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AqZsfK1VqfrB5kdjvmVO7Xw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vTudIA7y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AqZsfK1VqfrB5kdjvmVO7Xw.png" alt="" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  PHPSandbox
&lt;/h3&gt;

&lt;p&gt;PHPSandbox is basically a play ground for PHP developers. It has lots of handy features. Its a place where you can try out code snippets, PHP &lt;a href="https://packagist.org/"&gt;packages&lt;/a&gt;. Its the coolest way to share PHP code snippets and you can run it from anywhere its embedded.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;PHPSandbox is an online Code Sandbox made for PHP.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With PHPSandbox you can create a PHP CLI app, PHP web app or Laravel app.&lt;/p&gt;

&lt;p&gt;In this article we are going to be focusing on creating a Laravel application with PHPSandbox.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let me show you!
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_dxcY5aN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/919/1%2A0p6E-bZEBqPYAXjldrnnPA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_dxcY5aN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/919/1%2A0p6E-bZEBqPYAXjldrnnPA.png" alt="" width="800" height="300"&gt;&lt;/a&gt;Embedded code using PHPSandbox&lt;/p&gt;

&lt;p&gt;&lt;em&gt;That’s me trying out Zttp, a handy PHP package by&lt;/em&gt; &lt;a href="https://twitter.com/adamwathan"&gt;&lt;em&gt;Adam Wathan&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How To Create A PHP/Laravel Notebook
&lt;/h3&gt;

&lt;p&gt;Every of your code snippets on PHPSandbox is saved as a notebook for you. To get started, go to &lt;a href="http://stephenjude.me/articles/PHPSandbox.io"&gt;PHPSandbox.io&lt;/a&gt; and launch your own notebook. Make sure you signup with your GitHub account so your notebook won’t get lost.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0duBREvH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2AL3PFP3-mTfTlF_vA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0duBREvH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2AL3PFP3-mTfTlF_vA.png" alt="" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Laravel Notebook
&lt;/h3&gt;

&lt;p&gt;PHPSandbox supports Laravel. This feature according to &lt;a href="https://twitter.com/bosunski"&gt;Bosunski&lt;/a&gt;, is still in development but its very cool. You can now run a full-fledged Laravel application without setting up a local development environment. Hurray!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jmT-ddUc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2ArW0RiCzOj9Rdh0nZ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jmT-ddUc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2ArW0RiCzOj9Rdh0nZ.png" alt="" width="800" height="396"&gt;&lt;/a&gt;Laravel in PHPSandbox&lt;/p&gt;

&lt;p&gt;Laravel in PHPSandbox&lt;/p&gt;

&lt;p&gt;I know you already have lots of questions about requiring PHP/Laravel packages, creating .env files and running artisan commands. I saw it coming :)&lt;/p&gt;

&lt;h3&gt;
  
  
  PHP/Laravel Packages
&lt;/h3&gt;

&lt;p&gt;You can require PHP/Laravel packages. Doing this is very simple with PHPSandbox and there is no need for composer install, everything is all worked out for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ceaEby-U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2A6dR03jSbICqkUWW5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ceaEby-U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2A6dR03jSbICqkUWW5.png" alt="" width="800" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Laravel DotEnv File
&lt;/h3&gt;

&lt;p&gt;You can edit your .env file variables via PHPSandbox UI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qVvsbGQN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/710/0%2AXvNZXAUGCVp3byWa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qVvsbGQN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/710/0%2AXvNZXAUGCVp3byWa.png" alt="" width="710" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  PHP Artisan Commands
&lt;/h3&gt;

&lt;p&gt;Running Laravel artisan commands is done via PHPSandbox UI&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QmVNi52L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2AtqAHooqv8SKz82MG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QmVNi52L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2AtqAHooqv8SKz82MG.png" alt="" width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Import Laravel Projects From GitHub
&lt;/h3&gt;

&lt;p&gt;I think this is the sweetest part of PHPSandbox. You can import your Laravel project from GitHub and continue working on them on the from here. This is cool :)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pCqxkohi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2AGRuxwHHETd7SswM0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pCqxkohi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2AGRuxwHHETd7SswM0.png" alt="" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Currently you can only import a Laravel project.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Lots of features are still in beta and more are still coming to PHPSandbox. If you are following my &lt;a href="http://stephenjude.me/articles/bit.ly/laravel-lessons"&gt;Laravel series&lt;/a&gt; and you are having a hard time setting up a local development environment, maybe you should give &lt;a href="http://stephenjude.me/articles/phpsandbox.io"&gt;PHPSandbox&lt;/a&gt; a trial.&lt;/p&gt;

&lt;p&gt;Special thanks to &lt;a href="https://twitter.com/bosunski"&gt;Bosunski&lt;/a&gt;and his team for all the works and effort they have been putting into this project. THANK GUYS!&lt;/p&gt;

</description>
      <category>php</category>
      <category>codesandbox</category>
      <category>phpsandbox</category>
      <category>phpcli</category>
    </item>
    <item>
      <title>How To Deploy A Laravel Project On Linux Shared Hosting In 5 Minutes</title>
      <dc:creator>Stephen Jude</dc:creator>
      <pubDate>Mon, 13 Jan 2020 23:14:07 +0000</pubDate>
      <link>https://forem.com/stephenjude/how-to-deploy-a-laravel-project-on-linux-shared-hosting-in-5-minutes-ghp</link>
      <guid>https://forem.com/stephenjude/how-to-deploy-a-laravel-project-on-linux-shared-hosting-in-5-minutes-ghp</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Cza1y3IV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AghPtx6kY9Ib4GRyhfN3nwQ.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Cza1y3IV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AghPtx6kY9Ib4GRyhfN3nwQ.jpeg" alt="" width="800" height="581"&gt;&lt;/a&gt;Photo by &lt;a href="https://unsplash.com/@chrisliverani?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Chris Liverani&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/fast?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my &lt;a href="http://stephenjude.tech/articles/a-recap-of-2019-code19"&gt;2019 review&lt;/a&gt; I mentioned that I was working on a side project which is setting up a &lt;a href="https://getlitehost.com/index.php"&gt;shared hosting platform&lt;/a&gt; with &lt;a href="https://laravel.com/"&gt;Laravel&lt;/a&gt;developers in mind.&lt;/p&gt;

&lt;p&gt;I have deployed lots of Laravel projects on Linux shared hosting and I know how painful it is especially when there is no ssh access.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://getlitehost.com/"&gt;Litehost&lt;/a&gt; is here to solve that problem. It has ssh access on all its hosting plans and it has Composer, Git &amp;amp; PHP CLI pre-installed on its servers. Finally it pretty affordable, just &lt;strong&gt;₦400/month ($1.11).&lt;/strong&gt; Isn’t that amazing? &lt;a href="https://getlitehost.com/register.php"&gt;Litehost&lt;/a&gt; is live and its been accepting customer since 24th December 2019.&lt;/p&gt;

&lt;p&gt;Just yesterday I moved my blog which I built with Laravel to Litehost server. So I am going to show you how I did it in 5 minutes.&lt;/p&gt;

&lt;p&gt;Lets get to the main thing. I will assume you have already a Cpanel account with ssh access on it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Project Setup
&lt;/h3&gt;

&lt;p&gt;Push your Laravel project to a remote git repository. I already have &lt;a href="https://github.com/stephenjude/stephenjude.tech/"&gt;my blog’s repository&lt;/a&gt; on GitHub and its open source.&lt;/p&gt;

&lt;p&gt;Now lets go back to our Cpanel. If you have ssh access on your hosting plan, look for terminal under the advanced tab and click on it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QNJlL71c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/723/0%2AiGusnaOrlbh7Zo6c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QNJlL71c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/723/0%2AiGusnaOrlbh7Zo6c.png" alt="" width="723" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Move into your public directory and pull your Laravel project from your remote repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd public\_html

git clone [https://github.com/stephenjude/stephenjude.tech.git](https://github.com/stephenjude/stephenjude.tech.git) blog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this command you now have your project inside &lt;strong&gt;&lt;em&gt;public_html/blog&lt;/em&gt;&lt;/strong&gt; folder.&lt;/p&gt;

&lt;p&gt;Make a copy of your  &lt;strong&gt;.env.example&lt;/strong&gt; file and update your  &lt;strong&gt;.env&lt;/strong&gt; variables. You can do this using the CPanel file manager. Remember that &lt;strong&gt;Show Hidden Files (dotfiles)&lt;/strong&gt; must be enabled from the CPanel file manager settings.&lt;/p&gt;

&lt;p&gt;Now enter into the project folder and pull all the required dependencies.&lt;br&gt;
&lt;/p&gt;

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

composer install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fine, now we have our Laravel project ready to be served but its remaining one more thing. Laravel makes use of the storage folder for lots of things like writing logs, caching views and local file storage for uploads.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod 777 storage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I know this is not advisable but we are not on a VPS. We are on a shared server with some some limits to what we can do. Yeah.&lt;/p&gt;

&lt;p&gt;Finally you have to setup your ** .htaccess** file to point to your Laravel &lt;strong&gt;public&lt;/strong&gt; folder. You can find this  &lt;strong&gt;.htaccess&lt;/strong&gt; file inside the &lt;strong&gt;public_html&lt;/strong&gt; folder. if its not there then create one and update it with the code below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RewriteEngine on
RewriteCond %{REQUEST\_URI} !^blog/public
RewriteRule ^(.\*)$ /blog/public/$1 [L]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it, you have successfully deployed your Laravel project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I know this not the best way to deploy a Laravel project but I believe it’s efficient enough to get your project up and running on a &lt;a href="https://getlitehost.com/sharedhosting.php"&gt;Linux shared hosting&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I am still working on setting up shared hosting plans tailored for Laravel developers. The idea is to save time and deploy faster on shared hosting.&lt;/p&gt;

&lt;p&gt;Join my &lt;a href="https://stephenjude.tech/newsletter"&gt;weekly newsletter&lt;/a&gt; and never miss out on new tutorials, tips and more.&lt;/p&gt;

&lt;p&gt;You can also follow me on twitter &lt;a href="https://twitter.com/stephenjudeso"&gt;@stephenjudeso&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>linux</category>
      <category>deploy</category>
    </item>
    <item>
      <title>Using Multiple Instances of Redis For Your Laravel Application</title>
      <dc:creator>Stephen Jude</dc:creator>
      <pubDate>Wed, 11 Dec 2019 02:25:58 +0000</pubDate>
      <link>https://forem.com/stephenjude/using-multiple-instances-of-redis-for-your-laravel-application-5b4i</link>
      <guid>https://forem.com/stephenjude/using-multiple-instances-of-redis-for-your-laravel-application-5b4i</guid>
      <description>&lt;p&gt;I worked as a Laravel backend developer at&lt;a href="https://qwickpage.com"&gt;Qwickpage&lt;/a&gt; for a year. Qwickpage has lots of products that are still in their development stage but its is primarily a social network for entrepreneurs.&lt;/p&gt;

&lt;p&gt;While at Qwickpage we have two instances of the core application running on the server. One is for development while the other is served live (production).&lt;/p&gt;

&lt;p&gt;We make use of &lt;a href="https://redis.io/"&gt;Redis&lt;/a&gt;as our caching system for the two instances of the app and the end result was a conflict.&lt;/p&gt;

&lt;p&gt;The two applications (dev &amp;amp; live) were using the same instance of Redis on the server, each one keeps overriding the cached data of the other and returning wrong cached data.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Did We Fix This
&lt;/h3&gt;

&lt;p&gt;We fixed this by creating another instance of Redis that runs on port 6380. So the live app takes port 6379 while dev app takes 6380; We now have two instances of Redis running on our server.&lt;/p&gt;

&lt;p&gt;In this post, I will show you how you can create another instance of Redis on your Linux server. I will assume your already have Redis installed on your Linux server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Now Lets Go!
&lt;/h3&gt;

&lt;p&gt;To create another instance of Redis we need to duplicate the existing Redis configuration file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp /etc/redis/redis\_6379.conf /etc/redis/redis\_6380.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Update &lt;strong&gt;&lt;em&gt;port 6380&lt;/em&gt;&lt;/strong&gt; config file (&lt;em&gt;etc/redis/redis_6380.conf&lt;/em&gt;) like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pidfile /var/run/redis\_6380.pid
port 6380
logfile /var/log/redis/redis\_6380.log
dir /var/lib/redis/6380
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Create a &lt;strong&gt;&lt;em&gt;port 6380&lt;/em&gt;&lt;/strong&gt; working directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir /var/lib/redis/6380
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Update &lt;strong&gt;&lt;em&gt;port 6379&lt;/em&gt;&lt;/strong&gt; (&lt;em&gt;/etc/init.d/redis_6379&lt;/em&gt;) service script from this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/run/redis\_6379.pid
CONF="/etc/redis/6379.conf"
REDISPORT="6379"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NAME=`basename ${0}`
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/run/${NAME}.pid
CONF="/etc/redis/${NAME}.conf"
REDISPORT="${NAME#\*\_}"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Create a symlink script for port 6380 instance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ln -s /etc/init.d/redis\_6379 /etc/init.d/redis\_6380
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To start the two Redis server instances run this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/etc/init.d/redis\_6379 start
/etc/init.d/redis\_6380 start
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can now update the dotenv files of your two applications and assign them different Redis port respectively.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cheers!
&lt;/h3&gt;

&lt;p&gt;Join my &lt;a href="http://stephenjude.tech/newsletter"&gt;weekly newsletter&lt;/a&gt; and never miss out on news, tutorials, tips and more.&lt;/p&gt;

&lt;p&gt;You can also follow me on twitter &lt;a href="https://twitter.com/stephenjudeso"&gt;@stephenjudeso&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>servers</category>
      <category>redisserver</category>
      <category>qwickpage</category>
    </item>
    <item>
      <title>Upgrading To PHP 7.4 (Laragon)</title>
      <dc:creator>Stephen Jude</dc:creator>
      <pubDate>Mon, 02 Dec 2019 20:39:40 +0000</pubDate>
      <link>https://forem.com/stephenjude/upgrading-to-php-7-4-laragon-2po6</link>
      <guid>https://forem.com/stephenjude/upgrading-to-php-7-4-laragon-2po6</guid>
      <description>&lt;p&gt;Its no longer news that &lt;a href="https://www.php.net/archive/2019.php#2019-11-28-1"&gt;PHP 7.4&lt;/a&gt; is now available with lots of exciting new features. Yeah, and everyone wants to get a test of it :)&lt;/p&gt;

&lt;p&gt;PHP 7.4 comes with numerous improvements and new features such as: Typed Properties, Arrow Functions, Null coalescing assignment operator, Unpacking Inside Arrays, Opcache Preloading etc.&lt;/p&gt;

&lt;p&gt;You can walk your self through this new features &lt;a href="https://www.php.net/manual/en/migration74.new-features.php"&gt;here&lt;/a&gt;. Thanks to PHP development team. Bravo!&lt;/p&gt;

&lt;h3&gt;
  
  
  Laragon
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://laragon.org/docs/"&gt;Laragon&lt;/a&gt; is a modern, maintained and rich-featured local development environment. Laragon comes pre-installed with many popular applications like Node.js, PHP, Apache, Nginx, Redis, Composer, and MariaDB/MySQL. It’s currently available for only Windows OS. You can download it &lt;a href="https://laragon.org/download/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Please note that Laragon’s latest release as at the time I wrote this article haven’t shipped with PHP 7.4 and that’s the essence of this article.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Upgrading to PHP 7.4
&lt;/h3&gt;

&lt;p&gt;First lets download PHP 7.4 for &lt;a href="https://windows.php.net/download#php-7.4"&gt;Windows&lt;/a&gt;. Here is a direct link for &lt;a href="https://windows.php.net/downloads/releases/php-7.4.0-nts-Win32-vc15-x64.zip"&gt;64 bits&lt;/a&gt; and   &lt;a href="https://windows.php.net/downloads/releases/php-7.4.0-Win32-vc15-x86.zip"&gt;32 bits&lt;/a&gt;.&lt;a href="https://windows.php.net/downloads/releases/php-7.4.0-nts-Win32-vc15-x64.zip"&gt;&lt;/a&gt; Extract the downloaded zip file to Laragon’s PHP folder.&lt;/p&gt;

&lt;p&gt;Note that Laragon’s PHP folder can be found on this path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\laragon\bin\php
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9dX1eT41--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2ApueQcEVUhgWxK3hL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9dX1eT41--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2ApueQcEVUhgWxK3hL.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now open Laragon app on your system, click on Menu, navigate to the menu item, then change the PHP version to the latest one you have on your system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1EJFmOx6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/964/0%2AvzRGX331tzXNU2oz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1EJFmOx6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/964/0%2AvzRGX331tzXNU2oz.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you have your local development environment running PHP 7.4!&lt;/p&gt;

&lt;h4&gt;
  
  
  Cheers !
&lt;/h4&gt;

&lt;p&gt;Join my &lt;a href="http://stephenjude.tech/newsletter"&gt;weekly newsletter&lt;/a&gt; and never miss out on news, tutorials, tips and more.&lt;/p&gt;

&lt;p&gt;You can also follow me on twitter &lt;a href="https://twitter.com/stephenjudeso"&gt;@stephenjudeso&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>laragon</category>
      <category>php7</category>
      <category>upgradephp</category>
    </item>
    <item>
      <title>Getting Started With Laravel Lite Blog</title>
      <dc:creator>Stephen Jude</dc:creator>
      <pubDate>Fri, 18 Oct 2019 19:02:48 +0000</pubDate>
      <link>https://forem.com/stephenjude/getting-started-with-laravel-lite-blog-24ka</link>
      <guid>https://forem.com/stephenjude/getting-started-with-laravel-lite-blog-24ka</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3m_PJtZf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AWOoVgRLUBjsFkKXr" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3m_PJtZf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AWOoVgRLUBjsFkKXr" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my &lt;a href="http://stephenjude.tech/articles/building-my-personal-blog"&gt;previous post&lt;/a&gt;, I mentioned how I built &lt;a href="https://github.com/stephenjude/lite-blog"&gt;Lite Blog&lt;/a&gt;. In this post I will be detailing how to get started and some of the interesting features of &lt;a href="https://github.com/stephenjude/lite-blog"&gt;Lite Blog&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;Installing Lite Blog is pretty simple. Its just like installing a Laravel application using composer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer create-project --prefer-dist stephenjude/lite-blog myblog
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After the installation, create your database and update  &lt;strong&gt;.env&lt;/strong&gt; file with your database credentials. After that run the setup command inside the project directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd myblog

php artisan setup:blog
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will publish the public assets for the publishing platform (&lt;a href="https://github.com/writingink/wink"&gt;wink&lt;/a&gt;) and generate a login credentials for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I4pP96kb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/846/0%2AmrkMriPf42j3JiCa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I4pP96kb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/846/0%2AmrkMriPf42j3JiCa.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Visit myblog.test on your local machine to see your homepage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6cvg5zjS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2ARhuaOWt6F5IphtBt.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6cvg5zjS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2ARhuaOWt6F5IphtBt.PNG" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To create post visit myblog.test/editor and login with the generated credentials.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QOMbXmCL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A8oL_J3yec6bmchOc.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QOMbXmCL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A8oL_J3yec6bmchOc.PNG" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Site Configs
&lt;/h3&gt;

&lt;p&gt;Here we are going to set the site configuration for our blog. The site configs are inside the config/services.php file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'meta' =\&amp;gt; [
 'site\_name' =\&amp;gt; 'My Perosnal Blog',
 'mantra' =\&amp;gt; 'Web &amp;amp; Mobile Developer', 
],
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The site_name is the title of the blog while the mantra is what the site stands for usually under the title of the blog. Update them to fit your taste.&lt;/p&gt;

&lt;h3&gt;
  
  
  Social Profile Links
&lt;/h3&gt;

&lt;p&gt;Inside config/services.php add your social media profile links.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'social' =\&amp;gt; [
 'linkedin' =\&amp;gt; 'https://www.linkedin.com/in/username/',
 'email' =\&amp;gt; 'mailto:mail@gmail.com',
 'medium' =\&amp;gt; 'https://medium.com/@username',
 'github' =\&amp;gt; 'https://github.com/username',
 'twitter' =\&amp;gt; 'https://twitter.com/username',
 'atom' =\&amp;gt; '#',
 ],
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PHNik8TB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AoZ4H5ylImOtK4KDp.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PHNik8TB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AoZ4H5ylImOtK4KDp.PNG" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Unsplash Integration
&lt;/h3&gt;

&lt;p&gt;When creating post you might like to make use of free professional photos. Wink comes with Unsplash integration out of the box so head over to &lt;a href="https://unsplash.com/oauth/applications"&gt;Unspash,&lt;/a&gt;create a new Unsplash app. Grab the ‘Access Key’ and add it to your .env file as UNSPLASH_ACCESS_KEY&lt;/p&gt;

&lt;h3&gt;
  
  
  Compiling assets (Optional)
&lt;/h3&gt;

&lt;p&gt;In case you want to recompile the javascript. You have to install the nodejs packages and then run dev, just like you do in your Laravel application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install

npm run dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  SEO — Search Engine Optimizations
&lt;/h3&gt;

&lt;p&gt;The Laravel publishing platform I used on this project (wink) made a very nice provision for SEO. It was designed that every post you publish has fields where you can add your post’s SEO data. I have implemented this on the resources/views/post.blade.php.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IF58kfJI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/891/0%2A62e4o0sJkY4lW_3T.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IF58kfJI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/891/0%2A62e4o0sJkY4lW_3T.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the SEO image, I made use of post featured image. So automatically your featured image will appear as you share the post on twitter, facebook or any other social network sites.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c8RF-OxH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/882/0%2AGzzBI0x0s-h77I9M.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c8RF-OxH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/882/0%2AGzzBI0x0s-h77I9M.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I also used post tags as SEO keywords so adding tags to your post is a plus.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/stephenjude/lite-blog"&gt;Lite Blog&lt;/a&gt; is a Laravel application and its highly flexible for modification. You can find the project on &lt;a href="https://github.com/stephenjude/lite-blog"&gt;github&lt;/a&gt; and its open for contributions.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>liteblog</category>
      <category>blog</category>
      <category>php</category>
    </item>
  </channel>
</rss>
