<?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: skino</title>
    <description>The latest articles on Forem by skino (@skino2020).</description>
    <link>https://forem.com/skino2020</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%2F600988%2F36878a56-62ed-478e-8f6f-cdc8c8da13b1.jpg</url>
      <title>Forem: skino</title>
      <link>https://forem.com/skino2020</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/skino2020"/>
    <language>en</language>
    <item>
      <title>Laravel Envoy setup</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Tue, 30 Nov 2021 10:20:09 +0000</pubDate>
      <link>https://forem.com/skino2020/laravel-envoy-setup-2m0</link>
      <guid>https://forem.com/skino2020/laravel-envoy-setup-2m0</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I'm sure that I'm not the only person like this but i often forget to run certain commands when pulling my blog live from GitHub. The two I'm terrible for are &lt;strong&gt;php artisan&lt;/strong&gt; &lt;strong&gt;migrate&lt;/strong&gt; and &lt;strong&gt;php artisan config:cache&lt;/strong&gt;. I don't know what the reason is for this but its been a pain in the neck for me for a while, i shamefully spent 45 mins trying to figure out why my posts weren't going over to Dev.to and the only error i was getting was "connection refused". Turns out i had not run the config cache to make my .env changes live...&lt;/p&gt;

&lt;h3&gt;
  
  
  Introducing Envoy
&lt;/h3&gt;

&lt;p&gt;Envoy isn't a new package and I've just put off setting it up for no good reason until today.... its time to get the automation of my pull's to live working and it couldn't be easier!.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step One - Require the package
&lt;/h3&gt;

&lt;p&gt;As with almost all packages worth mentioning with Laravel this has a simple command to install:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer require laravel/envoy --dev

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

&lt;/div&gt;



&lt;p&gt;Ye that's really it for the installation...&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2 - Specify the server
&lt;/h3&gt;

&lt;p&gt;Envoy uses code from a file in the root of your project (which you need to create) called &lt;strong&gt;Envoy.blade.php&lt;/strong&gt;. In this file we will specify our Server and the jobs required.&lt;/p&gt;

&lt;p&gt;so firs things first we need to specify the server to run the code one.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@servers(['localhost' =&amp;gt; '127.0.0.1'])

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

&lt;/div&gt;



&lt;p&gt;I'm setting this up for my blog, so i don't have any replication as at this stage it would be overkill for my simple setup. if you wanted to add more than one server you would need to pass the server names and IP's to the Array like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@servers(['Raspada-web-1' =&amp;gt; '192.168.1.68', 'Raspada-web-2' =&amp;gt; '192.168.1.69'])

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3 - Lets tell a story!
&lt;/h3&gt;

&lt;p&gt;Thing i like about the way Envoy works is i can set it up and "talk out" my process like i do to my "Coding Duck"... if your Unsure what a coding duck is, quite simply its a rubber duck that when i'm struggling with a problem i talk through my issue with the duck... Sounds mental but it bloody works, often talking through your issue out loud will help you solve it... anyway back to our story. What should i be doing each time i make changes and make them live....&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git pull: Well duh! Merge the branch your working on into the main/master and pull to live&lt;/li&gt;
&lt;li&gt;Migrate: i want to run the migrate command just in case i have made some changes to tables.&lt;/li&gt;
&lt;li&gt;install composer packages for production: i want to install the packages for the live environment... not dev ones.&lt;/li&gt;
&lt;li&gt;Dump-Autoload: i want to clear out any auto-loaded classes that may have changed with my work completed.&lt;/li&gt;
&lt;li&gt;config-cache: i want to ensure all changes i have made to files like .env or saved to cache.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that's our story! so how do we define this? well we use the &lt;a class="mentioned-user" href="https://dev.to/story"&gt;@story&lt;/a&gt; code and name our story... for this tutorial were going to use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@story('code_update')
// story chapters here
@endstory

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

&lt;/div&gt;



&lt;p&gt;So my story so far is this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@servers(['localhost' =&amp;gt; '127.0.0.1'])

@story('code_update')
gitpull
migrate
composerinstall
dumpautoload
savenewconfig
@endstory

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4 - Create the Tasks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that we have our main story for envoy we need to make each individual task with the required code inside.&lt;/p&gt;

&lt;p&gt;So first things first id suggest layout out each task accordingly like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@servers(['localhost' =&amp;gt; '127.0.0.1'])

@story('code_update')
gitpull
migrate
composerinstall
dumpautoload
savenewconfig
@endstory


@task('gitpull')

@endtask

@task('migrate')

@endtask

@task('composerinstall')

@endtask

@task('dumpautoload')

@endtask

@task('savenewconfig')

@endtask

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

&lt;/div&gt;



&lt;p&gt;Starting to get the idea?&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5 - Add the commands
&lt;/h3&gt;

&lt;p&gt;For this bit you just need to write the commands you would normally run (when you don't forget :S ) inside each of the tasks. when you're finished you should have something like mine below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@task('gitpull')
    git pull
@endtask

@task('migrate')
    php artisan migrate --force
@endtask

@task('composerinstall')
    composer install --no-dev
@endtask

@task('dumpautoload')
    composer dump-autoload
@endtask

@task('savenewconfig')
    php artisan config:cache
@endtask

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 6 - Finish the story
&lt;/h3&gt;

&lt;p&gt;All good stories come to an end... and envoy isn't any different we need to set the @finished flag&lt;/p&gt;

&lt;p&gt;You could leave this blank if you wanted to but seems a bit daft when Envoy makes it so easy to integrate with platforms like Slack, MS teams and Discord.&lt;/p&gt;

&lt;p&gt;For this im going to be just using some text in the terminal for when i pull.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@finished
    if ($exitCode &amp;gt; 0) {
       &amp;lt;span class="hljs-regexp"&amp;gt;// There were errors in one of the tasks...
    }
@endfinished
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Run the Envoy command
&lt;/h3&gt;

&lt;p&gt;So first of we will pull this to our live environment after out branch merge (unless you were naughty and working on main/master!).&lt;/p&gt;

&lt;p&gt;we will then need to run composer install to just get Envoy working on live. and then you can run your full story by typing this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php vendor/bin/envoy run code_update

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

&lt;/div&gt;



&lt;p&gt;The first time i ran this i got a bit scared because i seen a wall of red text.... don't worry its fine!... and that it, if you really want to be clever you could alias the command in your terminal to something like deploy-blog, deploy-saas so from anywhere on your server it will CD to the directory and run the command for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  All done...
&lt;/h3&gt;


&lt;p&gt;Now this will go live and just work and it will make my life easier. i haven't even scratched the surface yet with what i can do with envoy, I've not spoken about queue:restarts as i don't have any queues yet, I've not talked about running the envoy stories on multiple servers at the same time either. there is so much more this package can do!&lt;br&gt;&lt;br&gt; &lt;/p&gt;
&lt;h2&gt;Raspada-Blog&lt;/h2&gt;  I post on my blog primarily and share the posts via API, please check out &lt;a href="//www.raspada-blog.co.uk"&gt;Raspada-Blog&lt;/a&gt; for more posts and information. If you have any questions please message me on twitter or use my website contact form.

</description>
      <category>git</category>
      <category>php</category>
      <category>laravelenvoy</category>
    </item>
    <item>
      <title>Manjaro - Laravel Dev Setup</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Wed, 24 Nov 2021 21:17:57 +0000</pubDate>
      <link>https://forem.com/skino2020/manjaro-laravel-dev-setup-2p3k</link>
      <guid>https://forem.com/skino2020/manjaro-laravel-dev-setup-2p3k</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I think its fair to say i have a bit of an addiction to Linux distro's.... over the last few months i have tried and tested a number of them and also blogged about a few... here is a brief list of distro's I've tested in the last 3 months.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ubuntu (Normal)&lt;/li&gt;
&lt;li&gt;Kubuntu (KDE)&lt;/li&gt;
&lt;li&gt;Lubuntu&lt;/li&gt;
&lt;li&gt;Elementary OS (my favourite so far)&lt;/li&gt;
&lt;li&gt;Pop!_OS&lt;/li&gt;
&lt;li&gt;Fedora 35&lt;/li&gt;
&lt;li&gt;Zorin Core&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that's probably missing a few... yes I'm a distro wh*re...&lt;/p&gt;

&lt;p&gt;The absolute beauty of Linux Distro's is you can get up and running with what you need really fast. In my case i can get my Laravel development environment setup in less than 30 minutes on Ubuntu based distro and that would include sorting out my ssh access and GitHub keys...&lt;/p&gt;

&lt;p&gt;With the exception of Fedora, all of the distributions above all have Ubuntu in common so the commands are all the same... so if you have followed my Elementary OS Dev setup it will work on all Debian based OS's&lt;/p&gt;

&lt;p&gt;But recently, I've tested out Manjaro KDE (Also Gnome) and so far... i love it! Although based on Arch its really easy to setup and fairly easy to use for software installation similar to Ubuntu...&lt;/p&gt;

&lt;p&gt;So the idea for this tutorial is to setup a few things and get Laravel Dev Environment setup done!. I will try to explain these commands as we go along to help sort of compare them to Debian based commands as best i can.&lt;/p&gt;

&lt;p&gt;So lets get started!&lt;/p&gt;

&lt;h3&gt;
  
  
  Chrome
&lt;/h3&gt;

&lt;p&gt;I'm not a fan of Firefox (just a personal preference) so i always install Chrome on any installation of Linux i do. Do do this in Manjaro you can use the terminal or you can enable AUR (Arch User Repository)... This is a community driven report to help users with Arch based Linux setups with software installs.&lt;/p&gt;

&lt;p&gt;AUR doesn't come enabled as standard but its SUPER easy to enable.&lt;/p&gt;

&lt;p&gt;Press your Super/Windows key and type "Add/Remove Software" and open the program. When in here you need to do the following.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the hamburger menu and select preferences&lt;/li&gt;
&lt;li&gt;Click the third Party Tab and set the "enable AUR Support" as active with the sub option of "check for updates"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FZMh22XTLKbXdUTbY3YF0uFeET5NWEfGpDwuxWAmL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FZMh22XTLKbXdUTbY3YF0uFeET5NWEfGpDwuxWAmL.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FGwJhMhMFfxSR2DBdIXmKKwrhZqKDQD7FkEZ5feRc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FGwJhMhMFfxSR2DBdIXmKKwrhZqKDQD7FkEZ5feRc.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it for enabling AUR.... now all you need to do is close the preferences window and search for chrome in the software search and it should be the top result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FPdnoHbDJ5dCHYl04bYy4eGgG6TS2mZf9iS4ZO4zO.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FPdnoHbDJ5dCHYl04bYy4eGgG6TS2mZf9iS4ZO4zO.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Terminal Setup
&lt;/h3&gt;

&lt;p&gt;One great thing about Manjaro is, it comes with ZSH / OhMyZsh pre installed so there is zero config to do, it has the 3 plugins i use and love already&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git&lt;/li&gt;
&lt;li&gt;ZSH AutoComplete&lt;/li&gt;
&lt;li&gt;ZSH AutoSyntaxHighlights&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can add some more if you need but.... its not necessary. Another cool thing i like about Manjaro KDE is there is two terminal applications out of the box... You have &lt;strong&gt;Konsole&lt;/strong&gt; and then &lt;strong&gt;Yakuake&lt;/strong&gt;... Now i spend a lot of time with a terminal window open but occasionally I'll just need to run something quickly without having to open from the program menu etc. With Yakuake you just need to press F12 and you get a beautiful drop down terminal! this uses the same configs as you main terminal so no extra setup required.... NEAT!&lt;/p&gt;

&lt;p&gt;Next... Lets start on building our Dev environment&lt;/p&gt;

&lt;h3&gt;
  
  
  All important update
&lt;/h3&gt;

&lt;p&gt;As with any new software installation, its always good practice to update/upgrade your packages and repo's... With Manjaro's Pacman this is done with one command&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;What this command essentially does is combine the sudo apt update &amp;amp;&amp;amp; sudo apt upgrade into a single command. All in all it does the same thing. It checks the remote repo's for updates, synchronises with local repo then updates it and your system. If this is the first time you have run this command it could take up to 5 minutes to run.&lt;/p&gt;

&lt;p&gt;Mine was update already so i got the below screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FnPCLjo4DTR9eiOstqYeTO3VME40xrzJVtnLl6IBz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FnPCLjo4DTR9eiOstqYeTO3VME40xrzJVtnLl6IBz.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Dev Environment
&lt;/h2&gt;

&lt;p&gt;As I'm a Laravel Developer, i want to Have PHP, Nginx and MySQL running as a base standard. In Manjaro's favour there is a fair bit installed out of the box which cuts the setup down slightly.&lt;/p&gt;

&lt;h3&gt;
  
  
  First of all... Git
&lt;/h3&gt;

&lt;p&gt;Super easy... The following command will install Git for you&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo pacman -S git

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

&lt;/div&gt;



&lt;p&gt;and then to check its installed correctly just run the version check&lt;br&gt;
&lt;/p&gt;

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

// Result - git version 2.34.0

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

&lt;/div&gt;



&lt;p&gt;Done!&lt;/p&gt;

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

&lt;p&gt;This next bit may turn some peoples stomachs as its a "lazy method"... although were going to install Valet Linux shortly which uses Nginx, were going to install PHP-APACHE now as it comes bundled with a number of packages which we will use. We will disable Apache later on in the tutorial.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo pacman -S php php-apache

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

&lt;/div&gt;



&lt;p&gt;Installation Complete, Now lets edit the php.ini&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/php/php.ini

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

&lt;/div&gt;



&lt;p&gt;Find and uncomment the following extensions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;extention=bcmath&lt;/li&gt;
&lt;li&gt;extention=zip&lt;/li&gt;
&lt;li&gt;extension=pdo_mysql&lt;/li&gt;
&lt;li&gt;extension=iconv&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + X, Y and enter to save the changes and your done with PHP.... Easy right!&lt;/p&gt;

&lt;h3&gt;
  
  
  Install MariaDB
&lt;/h3&gt;

&lt;p&gt;I've always used the normal MySQL install for my local environment, but for some reason its a pain to get installed on Arch based systems and as such the recommendation is to use MariaDB which functions exactly the same to us developers but does require a few more steps to get installed. so first off lets install MariaDB&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo pacman -S mariadb

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

&lt;/div&gt;



&lt;p&gt;Now this is where i got confused most doc's say this is enough to get it going... i have found this isn't the case so far and you need to Initialise the MySQL Directory, this can be done with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mysql_install_db --user=mysql --basedir=&amp;lt;span class="hljs-regexp"&amp;gt;/usr --datadir=/var/lib/mysql
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Fa0Qj8sLFocjoLnROWhsdJ2AD3eUAwdggRhTNgK1K.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Fa0Qj8sLFocjoLnROWhsdJ2AD3eUAwdggRhTNgK1K.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next lets ensure the MySQL service starts when you reboot or startup your machine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl start mysqld

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

&lt;/div&gt;



&lt;p&gt;Next lets setup MySQL for use!&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FQFFGlv1kJEe9vrKNgfjJjgL0nCyXn7OVkJiRzIaH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FQFFGlv1kJEe9vrKNgfjJjgL0nCyXn7OVkJiRzIaH.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To check its installed and working just open up mysql command prompt with&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;If you see the following prompt, You're good to go!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MariaDB [(&amp;lt;span class="hljs-literal"&amp;gt;none)]&amp;gt; 
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Composer
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FopWLdheTCx9IDnrjBCVFYH6PzhZsGoKXSJbX9oRW.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FopWLdheTCx9IDnrjBCVFYH6PzhZsGoKXSJbX9oRW.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;you can install composer real easy like so&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -sS https://getcomposer.org/installer | php

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

&lt;/div&gt;



&lt;p&gt;And that should be it... if you type &lt;strong&gt;composer --version&lt;/strong&gt; in your terminal now it should show you the current version installed.&lt;/p&gt;

&lt;p&gt;If it doesn't show the version, Try running the following command :&lt;/p&gt;

&lt;p&gt;sudo mv composer.phar /usr/local/bin/composer&lt;/p&gt;

&lt;p&gt;And adding the next 2 lines to the bottom of the manjaro-zsh-config&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /usr/share/zsh/manjaro-zsh-config 

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

&lt;/div&gt;



&lt;p&gt;And&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PATH=$HOME/.config/composer/vendor/bin:~/.composer/vendor/bin:$PATH
export PATH

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

&lt;/div&gt;



&lt;p&gt;Now the &lt;strong&gt;composer --version&lt;/strong&gt; should work fine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Valet Linux - Prerequisites and install&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run the following command to ensure Valet Linux has the correct software installed for it to work&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo pacman -S nss jq xsel networkmanager

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

&lt;/div&gt;



&lt;p&gt;Next, install Valet Linux. Under &lt;strong&gt;NO CIRCUMSTANCES&lt;/strong&gt; should you run this command as sudo, it will require a complete removal and restart if you do... (when i did it i ended up just rebuilding my OS from scratch....)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer global require cpriego/valet-linux

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

&lt;/div&gt;



&lt;p&gt;And then&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;Next were going to make a directory and park valet in it so it knows to serve from that directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir ~/www
cd ~/www
valet park

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

&lt;/div&gt;



&lt;p&gt;The directory can be called what ever you want, www is just something i have always used. Next were going to assign a domain tld so its not .test&lt;/p&gt;

&lt;p&gt;this can be what ever you want, but i always go with .vm&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;Done.&lt;/p&gt;

&lt;h3&gt;
  
  
  ﻿﻿Install Laravel
&lt;/h3&gt;

&lt;p&gt;Another easy one to do, simply type the following command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer global require laravel/installer

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

&lt;/div&gt;



&lt;p&gt;next CD to your www directory and test the Laravel install is working correctly by creating a test project&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~/www
laravel new test

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

&lt;/div&gt;



&lt;p&gt;As long as its all gone to plan you should see the Laravel logo in terminal and then a shed load of dependencies being dragged down for the application.&lt;/p&gt;

&lt;p&gt;That's Laravel globally accessible to you now.&lt;/p&gt;

&lt;h3&gt;
  
  
  A few more little things
&lt;/h3&gt;

&lt;p&gt;So remember earlier when i mentioned we were installing Apache PHP for ease of installing packages... well its time to disable that and stop it from loading at system boot... If we don't Nginx wont work and neither will our dev environment. to do this we run the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl disable apache2 &amp;amp;&amp;amp; sudo systemctl stop apache2

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

&lt;/div&gt;



&lt;p&gt;and then we need to make sure Nginx starts up with the next command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable nginx

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

&lt;/div&gt;



&lt;p&gt;Now, the first command is a bit odd... I've installed Manjaro a few times now, through VM's for testing and onto the machine I'm using now. The strange bit is sometimes installing the Apache2 doesn't start it but other times it does.... so it may not be necessary but doesn't hurt to run it.&lt;/p&gt;

&lt;p&gt;Now in Laravel your definitely going to use NPM so lets install it. Again another single command and its done.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo pacman -S nodejs npm

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

&lt;/div&gt;



&lt;p&gt;You can install Node/npm with SNAP but you have to enable that and its not always the "cleanest" way of doing things.&lt;/p&gt;

&lt;p&gt;Before jumping into your browser and being disappointed when test.vm doesn't work, Reboot your machine and when its back up and running you can hit the test.vm URL and it will work.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2F3A3w1TgDClWSkVcbnQPiOvhVShJDecgAZluPe0LH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2F3A3w1TgDClWSkVcbnQPiOvhVShJDecgAZluPe0LH.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;Finally install your IDE Of choice (&lt;em&gt;i use PHPstorm and Datagrip&lt;/em&gt;) and start coding! I hope this has been helpful!&lt;br&gt;&lt;br&gt; &lt;/p&gt;
&lt;h2&gt;Raspada-Blog&lt;/h2&gt;  I post on my blog primarily and share the posts via API, please check out &lt;a href="//www.raspada-blog.co.uk"&gt;Raspada-Blog&lt;/a&gt; for more posts and information. If you have any questions please message me on twitter or use my website contact form.

</description>
      <category>linux</category>
      <category>php</category>
      <category>manjaro</category>
    </item>
    <item>
      <title>Pretty System Specs</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Mon, 22 Nov 2021 08:23:32 +0000</pubDate>
      <link>https://forem.com/skino2020/pretty-system-specs-ca1</link>
      <guid>https://forem.com/skino2020/pretty-system-specs-ca1</guid>
      <description>&lt;h3&gt;
  
  
  Intro
&lt;/h3&gt;

&lt;p&gt;One thing i spotted when i started using Tech Twitter was people would post screenshots of there system specifications in terminals with pretty logos etc and i wanted to know how it was all done!...... its actually SUPER simple.&lt;/p&gt;

&lt;h3&gt;
  
  
  NeoFetch
&lt;/h3&gt;

&lt;p&gt;NeoFetch is a free, easy to install application which gathers system information and prints it to the terminal in a "pretty way". It pulls together all of your system information and strips out the crap and displays it in a way that doesnt hurt the brain....&lt;/p&gt;

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

&lt;p&gt;Installing NeoFetch is as easy as typing the following two commands....&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo add-apt-repository ppa:dawidd0811/neofetch

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

&lt;/div&gt;



&lt;p&gt;and&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt install neofetch

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

&lt;/div&gt;



&lt;p&gt;this add the official NeoFetch PPA to your ubuntu installation and means you will always get the most up to date version.&lt;/p&gt;

&lt;p&gt;after that simply type &lt;code&gt;neofetch&lt;/code&gt; in your terminal and you will get a screenshot like below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FYboANKtlpf5muz3vriQ1JaYcfV7X7KZl3w8lnhPN.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FYboANKtlpf5muz3vriQ1JaYcfV7X7KZl3w8lnhPN.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another app you can use is screenfetch which does near enough the exact same thing!.&lt;/p&gt;

&lt;p&gt;Install it with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install screenfetch

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

&lt;/div&gt;



&lt;p&gt;and then just type &lt;code&gt;screenfetch&lt;/code&gt; in your terminal to get your system specs like below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FT2O8GxyPwHVtF5NXroZ1g1WBvB191J7taz9kLjR3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FT2O8GxyPwHVtF5NXroZ1g1WBvB191J7taz9kLjR3.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;Well thats going to do it today hope this quick blog post will be of interest and help you out. as a side note you can also get Screenfetch for MacOS.&lt;br&gt;&lt;br&gt; &lt;/p&gt;
&lt;h2&gt;Raspada-Blog&lt;/h2&gt;  I post on my blog primarily and share the posts via API, please check out &lt;a href="//www.raspada-blog.co.uk"&gt;Raspada-Blog&lt;/a&gt; for more posts and information. If you have any questions please message me on twitter or use my website contact form.

</description>
      <category>specs</category>
      <category>linux</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Elementary OS - Dev Environment Setup</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Sat, 20 Nov 2021 22:13:26 +0000</pubDate>
      <link>https://forem.com/skino2020/elementary-os-dev-environment-setup-1jjh</link>
      <guid>https://forem.com/skino2020/elementary-os-dev-environment-setup-1jjh</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;So every now and then i see something that catches my eye. Recently that seems to be Linux Distributions, over the last few months i have changed my distribution's a few times to try and find one i'm comfortable with. I moved from my iMac (getting a bit sluggish) to Ubuntu originally and it worked but i didn't "enjoy it", i then tried Manjaro, then Pop!_OS and then finally thought id have a go with &lt;a href="https://elementary.io/" rel="noopener noreferrer"&gt;Elementary OS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So far i am really enjoying it! it feels a bit "Mac'ish", Looks nice and feels quick!&lt;/p&gt;

&lt;p&gt;But compared to Ubuntu its a little bit different with the Setup of the dev environment, so i thought id write up a little tutorial on setting a Laravel Dev Environment on Elementary OS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let's get started!
&lt;/h3&gt;

&lt;p&gt;So as with any tutorial i do with Linux, we start with an update/upgrade.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt upgrade

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

&lt;/div&gt;



&lt;p&gt;If this is a fresh install you're setting up on, it could take few more mins than usual, Any messages you get for Diskspace just accept them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;After this operation, 36.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Git!
&lt;/h3&gt;

&lt;p&gt;Git is something use a lot anyway so its worth installing it. works from the IDE and normal terminals when working so it just helps.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install git

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

&lt;/div&gt;



&lt;p&gt;When the install is finished type &lt;code&gt;git --version&lt;/code&gt; in you're terminal and you should see something like: &lt;strong&gt;git version 2.25.1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Boom! GIt is installed!&lt;/p&gt;

&lt;h3&gt;
  
  
  Time to install ZSH
&lt;/h3&gt;

&lt;p&gt;This is a personal preference for me, but i cant recommend the terminal application enough, it cleans up your terminal window to a nice clean output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install zsh

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

&lt;/div&gt;



&lt;p&gt;Now you can stick with ZSH in its basic form, or you can install &lt;a href="https://github.com/romkatv/powerlevel10k" rel="noopener noreferrer"&gt;PowerLineLevel10k&lt;/a&gt; later on, which again id recommend as there is a shed load of options to use. but for the purpose of this tutorial... i'm just doing the basic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install PHP and Relevant dependencies.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y php8.0

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

&lt;/div&gt;



&lt;p&gt;And once that's done you can check the version by typing &lt;code&gt;php -v&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;➜  ~ php -v                                        
PHP 8.0.10 (cli) (built: Aug 26 2021 15:50:07) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.10, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.10, Copyright (c), by Zend Technologies

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

&lt;/div&gt;



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

&lt;p&gt;The Laravel framework requires some PHP Dependencies, these can be installed in a single command. The Dependencies are;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenSSL&lt;/li&gt;
&lt;li&gt;Common&lt;/li&gt;
&lt;li&gt;BCMath&lt;/li&gt;
&lt;li&gt;Curl&lt;/li&gt;
&lt;li&gt;mbstring&lt;/li&gt;
&lt;li&gt;MySQL&lt;/li&gt;
&lt;li&gt;XML&lt;/li&gt;
&lt;li&gt;zip&lt;/li&gt;
&lt;li&gt;sqlite3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you go to the Laravel website there will be a requirement for &lt;strong&gt;php-json&lt;/strong&gt; also. But, with PHP 8 it comes with it, so there is no extra install to complete. This will also include some of the Valet Dependencies.&lt;/p&gt;

&lt;p&gt;The command for all of these is as follows. (Type 'y' to the question about disk space)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install openssl php8.0-cli php8.0-curl php8.0-mbstring php8.0-mcrypt php8.0-xml php8.0-zip php8.0-common php8.0-bcmath php8.0-mysql php8.0-sqlite3

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Composer
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FgbWtHrEpsQ8PRMk4dzo0Ilo5sYHPGvgFkp3UdIiR.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FgbWtHrEpsQ8PRMk4dzo0Ilo5sYHPGvgFkp3UdIiR.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have no idea why but on my windows machine i used to learn dev work on i always struggled to get composer working properly. On Linux and macOS it just seemed easier...&lt;/p&gt;

&lt;p&gt;The following commands needs to be run in terminal, I tend to run them one at a time just in case, but as far as i'm aware you can run them all at the same time.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: hash_file command is subject to change, so it might be worth checking for the latest command for this&lt;/em&gt; &lt;a href="https://getcomposer.org/download/" rel="noopener noreferrer"&gt;&lt;em&gt;here&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

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

&lt;/div&gt;



&lt;p&gt;Now lets make it Globally accessible so you can just run &lt;code&gt;composer &amp;lt;Your Command&amp;gt;&lt;/code&gt; Instead of &lt;code&gt;php composer.phar &amp;lt;your command&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You need to move the composer.phar file to a location that is part of your systems path. In my case running Elementary 6 its &lt;strong&gt;/usr/local/bin/composer&lt;/strong&gt; The command for this is simply;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mv composer.phar /usr/local/bin/composer

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

&lt;/div&gt;



&lt;p&gt;now if you type &lt;code&gt;composer --version&lt;/code&gt; You should get your current composer version.&lt;/p&gt;

&lt;p&gt;Now we need to add composer to our global path so ZSH can use it correctly as well. Open the ZSH config;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano ~/.zshrc

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

&lt;/div&gt;



&lt;p&gt;Paste the following lines at the bottom of the file;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PATH=$HOME/.config/composer/vendor/bin:~/.composer/vendor/bin:$PATH
export PATH

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

&lt;/div&gt;



&lt;p&gt;Just above this command add a shortcut to a folder you will make in a second (if you want to). i add an alias to my &lt;strong&gt;zshrc&lt;/strong&gt; file called &lt;strong&gt;wd&lt;/strong&gt; and this will Change Directory to &lt;strong&gt;~/www&lt;/strong&gt; add the the below command BEFORE the PATH export.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias wd="cd ~/www"

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

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Ctrl + X&lt;/code&gt; to exit and &lt;code&gt;Save modified buffer? y&lt;/code&gt; and hit enter.&lt;/p&gt;

&lt;p&gt;Now apply them changes by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source ~/.zshrc

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Lets install Valet Linux
&lt;/h3&gt;

&lt;p&gt;Valet is awesome, early in my Laravel journey i used homestead which is also very powerful but can be cumbersome. Average memory usage could be a gig or two whereas Valet..... 7mb..... Yep 7MB, you can park your domains so you can use ANY folder on your system you want for ease of use. I believe Valet was originally designed just for macOS but has since been ported to both Windows and Linux.&lt;/p&gt;

&lt;p&gt;If you checkout the requirements for Valet-Linux &lt;a href="https://cpriego.github.io/valet-linux/requirements" rel="noopener noreferrer"&gt;here&lt;/a&gt; you will see there are a number of Dependencies required. You'll also note that we have installed the &lt;strong&gt;PHP Extensions&lt;/strong&gt; and &lt;strong&gt;Optional Packages&lt;/strong&gt; already when we first installed PHP. we now just need to run the following command to grab the OS packages required for Linux Valet:&lt;/p&gt;

&lt;p&gt;Network Manager tools for Valet&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install network-manager libnss3-tools jq xsel

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

&lt;/div&gt;



&lt;p&gt;one the prerequisites have installed it's time to time to composer require it from the Git repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer global require cpriego/valet-linux

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

&lt;/div&gt;



&lt;p&gt;Once that has run you need to install the package like so:&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;Once you press enter to this it will start running through checks for the Valet installations. In my installation &lt;strong&gt;nginx&lt;/strong&gt;, &lt;strong&gt;php7.4-fpm&lt;/strong&gt;, &lt;strong&gt;dnsmasq&lt;/strong&gt; and &lt;strong&gt;inotify-tools&lt;/strong&gt; were not installed and Valet automatically pulled these down and installed for me.&lt;/p&gt;

&lt;p&gt;Once its finished you should have received: &lt;code&gt;Valet Installed successfully!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Time to create our websites folder. My preferred sites folder is &lt;strong&gt;www&lt;/strong&gt;. so lets make that in the root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir ~/www

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

&lt;/div&gt;



&lt;p&gt;Now we have created our websites folder we need to tell Valet that's where our sites will be hosted locally, With windows and homestead you need to add the directories manually to the &lt;strong&gt;Homestead.yaml&lt;/strong&gt; but with Valet it couldn't be any easier!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~/www
valet park

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

&lt;/div&gt;



&lt;p&gt;﻿That's it, now when you add a site to that folder it will generate the necessary dns records and links so you can run something like: &lt;code&gt;raspada-blog.vm&lt;/code&gt; And it will load the site.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install MySQL
&lt;/h3&gt;

&lt;p&gt;We could actually just go ahead and install the Laravel package but nine times out of ten we will need a MySQL DB so lets get that done now.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install mysql-server -y

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

&lt;/div&gt;



&lt;p&gt;Remember to just accept the installation message for MySQL.&lt;/p&gt;

&lt;p&gt;Now the next bit is entirely up to you, however i will say that i select &lt;code&gt;Y&lt;/code&gt; to everything in the next installation process. And when it gets to the Password Tool, select &lt;code&gt;0&lt;/code&gt; as your complexity.&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;If you're, installing on a server you want to add a higher level password for security reason... but locally, it really doesn't matter.&lt;/p&gt;

&lt;p&gt;And that is it, MySQL is installed and you can check the installation with this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl status mysql.service

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

&lt;/div&gt;



&lt;p&gt;And you should see the following output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;➜  ~ systemctl status mysql.service
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2021-09-12 15:08:29 UTC; 2h 24min ago
    Process: 800 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 926 (mysqld)
     Status: "Server is operational"
      Tasks: 37 (limit: 18755)
     Memory: 418.1M
     CGroup: /system.slice/mysql.service
             └─926 /usr/sbin/mysqld

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

&lt;/div&gt;



&lt;p&gt;So were not using the root user in MySQL by default were going to create another user with all privileges, including grant privileges.&lt;/p&gt;

&lt;p&gt;To open up MySQL Command line Type:&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;Now you will be faced with the &lt;code&gt;mysql&amp;gt;&lt;/code&gt; prompt now lets create a user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE USER 'raspadatest'@'localhost' IDENTIFIED BY 'ThisIsMyNewPassword12!';

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

&lt;/div&gt;



&lt;p&gt;That's the user created! now lets grant all privileges, do this by typing the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GRANT ALL PRIVILEGES ON *.* TO 'raspadatest'@'localhost'; 

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

&lt;/div&gt;



&lt;p&gt;That's our new user with rights to all tables we currently have but will also create in the future.&lt;/p&gt;

&lt;p&gt;We need to flush privileges now:&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;to test it we can exit out the MySQL prompt by typing:&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;And that's it. which ever client you decide to use, login with what ever you created above on &lt;code&gt;localhost&lt;/code&gt; or &lt;code&gt;127.0.0.1&lt;/code&gt; and you're good to go.&lt;/p&gt;

&lt;p&gt;Now if you want to manage the DB's with a GUI instead of going through command line you can install MySQL &lt;strong&gt;Workbench&lt;/strong&gt; or &lt;strong&gt;phpMyAdmin&lt;/strong&gt; i prefer to use DataGrip from JetBrains. I wont go through the specifics of that as it will depend on what you want to install. But if your following along and using Datagrip also you can simply run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo snap install datagrip --classic

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Laravel!
&lt;/h3&gt;

&lt;p&gt;This bit is just a single command...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer global require laravel/installer

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

&lt;/div&gt;



&lt;p&gt;And that's it, CD into your website directory and run the:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;laravel new *site* - change site to you site name

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

&lt;/div&gt;



&lt;p&gt;running the above command will add the relevant links so you can run site.test and you will be directed to your new application.&lt;/p&gt;

&lt;p&gt;All done, you now have a fully functioning Laravel development server locally with Elementary OS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other things to do
&lt;/h2&gt;

&lt;p&gt;Make sure you setup your local .env if your pulling from Git.... I stupidly spent around an hour wondering why i couldn't access my site! its because i didn't have an .env properly configured for local environment.&lt;/p&gt;

&lt;p&gt;Another thing i tend to do is change the domain from test to &lt;strong&gt;.vm&lt;/strong&gt; this is easily done by running the following command:&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;Apache2 still showing up when you try access one of your sites? This happened with me and i needed to run the following to stop Apache2 from startup up with system reboot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl disable apache2 &amp;amp;&amp;amp; sudo systemctl stop apache2

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

&lt;/div&gt;



&lt;p&gt;That should stop Apache2 from starting when the machine boots up, we now need to get &lt;strong&gt;nginx&lt;/strong&gt; starting up with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable nginx

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

&lt;/div&gt;



&lt;p&gt;Need to install NodeJS? use the following two commands one for NodeJS itself and also the build essentials.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs

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

&lt;/div&gt;



&lt;p&gt;and&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apt-get install -y build-essential

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

&lt;/div&gt;



&lt;p&gt;All done!&lt;/p&gt;

&lt;p&gt;So far this has been my biggest Blog post so i hope it was all good, if you have any suggestions please drop me a message :D&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Word
&lt;/h3&gt;

&lt;p&gt;I hope this little walk through has has been helpful for you all!.&lt;/p&gt;


&lt;p&gt;if you found this post useful please consider following me on twitter &lt;a href="https://twitter.com/skino2020" rel="noopener noreferrer"&gt;@skino2020&lt;/a&gt; and if you found it really helpful consider buying me a coffee &lt;a href="https://www.buymeacoffee.com/skino2020" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;br&gt;&lt;br&gt; &lt;/p&gt;
&lt;h2&gt;Raspada-Blog&lt;/h2&gt;  I post on my blog primarily and share the posts via API, please check out &lt;a href="//www.raspada-blog.co.uk"&gt;Raspada-Blog&lt;/a&gt; for more posts and information. If you have any questions please message me on twitter or use my website contact form.

</description>
      <category>linux</category>
      <category>php</category>
      <category>mysql</category>
    </item>
    <item>
      <title>LEMP Stack &amp; Certbot</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Sat, 20 Nov 2021 14:11:53 +0000</pubDate>
      <link>https://forem.com/skino2020/lemp-stack-certbot-n8k</link>
      <guid>https://forem.com/skino2020/lemp-stack-certbot-n8k</guid>
      <description>&lt;h2&gt;
  
  
  A bit of background
&lt;/h2&gt;

&lt;p&gt;Last month i was helping out a friend with some server logs on a &lt;strong&gt;Hetzner Cloud&lt;/strong&gt; Package and was quite impressed with the Hetzner server controls etc... then my buddy told me the price and i was blown away... for cheaper than i was paying he was getting more bang for his buck! so i made the decision to switch servers this month.&lt;/p&gt;

&lt;h3&gt;
  
  
  Nginx or Apache?
&lt;/h3&gt;

&lt;p&gt;Since i started Web Development i have always used Apache as it was the "go to install" for PHP developers and LAMP was the first i heard to go with.... so stuck with it. On twitter i kept hearing Nginx was a good one to go with, use that... its worth it etc better performance etc.... i don't know how much of it is true but i went with Nginx this time round and so far I'm REALLY liking it. Although Config Syntax is different I'm not finding it difficult to apply the logic from Apache2 stuff to Nginx.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lets get Started!
&lt;/h3&gt;

&lt;p&gt;I'm going to go through the process i followed in order to install LEMP... i want go through in detail what to do with the commands once they have run but to be honest, the setup is simple enough.&lt;/p&gt;

&lt;p&gt;If your just starting out and need something to help you with the initial Server Setup, Please check out &lt;a href="https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04" rel="noopener noreferrer"&gt;Digital Ocean - Initial Server Setup with Ubuntu 20.04&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is a great resource for initial setup !&lt;/p&gt;

&lt;p&gt;LEMP Stack, Basically means &lt;strong&gt;L&lt;/strong&gt;inux, &lt;strong&gt;E&lt;/strong&gt;ngineX, &lt;strong&gt;M&lt;/strong&gt;ySQL &amp;amp; &lt;strong&gt;P&lt;/strong&gt;HP... that's really it. a few things you'll need an understanding of, Basic Linux Command Line tools and how to navigate your Ubuntu installation without issue.&lt;/p&gt;

&lt;p&gt;First things first lets check if the ufw is enabled and if not enable it with the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw status
sudo ufw enable
sudo ufw status﻿

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

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FqJVzuBBOqpQ2FJIstj9zCPjoT6mZYBrOFHQSf3zd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FqJVzuBBOqpQ2FJIstj9zCPjoT6mZYBrOFHQSf3zd.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's the firewall essentially set up.... dead easy right!&lt;/p&gt;

&lt;p&gt;As with any install of software on Ubuntu Server we start with and update to apt followed by the actual software we want.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt install nginx

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note:&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;You will need to answer Y to any prompts you get from the install.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Enable Nginx through the firewall﻿
&lt;/h3&gt;

&lt;p&gt;The ufw is a great little tool and is quite literally an "Uncomplicated FireWall" which you can enable and disable rules with text alone... Cool right!&lt;/p&gt;

&lt;p&gt;If you run &lt;code&gt;sudo ufw app&lt;/code&gt;&lt;code&gt;list&lt;/code&gt; it will display a list of applications that can be enabled and disabled easily.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FBpRlH1lCsGTtfClYW71cabs38Jjl6CMddJ2HJFyI.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FBpRlH1lCsGTtfClYW71cabs38Jjl6CMddJ2HJFyI.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To enable a setting is a piece of cake! simply type the following to enable Nginx (with HTTPS Support)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw allow 'Nginx Full'

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

&lt;/div&gt;



&lt;p&gt;Now if you run &lt;code&gt;sudo ufw status&lt;/code&gt; you will get something like below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FdCbsiOGZHuE9R98Ui73ZxfLachFzttlFHHRPc3KK.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FdCbsiOGZHuE9R98Ui73ZxfLachFzttlFHHRPc3KK.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see in my screenshot above i was a bit lazy and haven't disabled the HTTP yet which isn't really required with Nginx Full enabled.&lt;/p&gt;

&lt;p&gt;if you go to http://&lt;em&gt;YOUR_SERVER_IP_HERE&lt;/em&gt; in a browser you will now be faced with the below screen:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FF7xAITFZjvCnnro7u9tN34uooyEq6rTsLhNKVJhQ.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FF7xAITFZjvCnnro7u9tN34uooyEq6rTsLhNKVJhQ.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and that's it... Nginx is now ready to serve up static sites.&lt;/p&gt;

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

&lt;p&gt;If your coming to this tutorial now you will need to &lt;code&gt;sudo apt&lt;/code&gt;&lt;code&gt;update&lt;/code&gt; to get your packages ready, if your following on from before simply run the following to get MySQL server installed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install mysql-server

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

&lt;/div&gt;



&lt;p&gt;Select &lt;code&gt;Y&lt;/code&gt; to the next few prompts.&lt;/p&gt;

&lt;p&gt;Now the next bit has caused me a bit of confusion for a while as it asks if you want to enable the "VALIDATE PASSWORD PLUGIN"... i dont know why but every time i selected no to this... my MySQL installation would complete and i wouldn't be able to login.... dont know why, never got to the bottom of it... so i just enable it with low length security for Dev environment and high level for production. Type the following into 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;sudo mysql_secure_installation

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

&lt;/div&gt;



&lt;p&gt;This will launch the SQL Installation. I've screenshot the first bit for clarity the rest you can remove or not as needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FvfMYvxWifMNbsQtngPsLimKYyt6BidNQSparCFrm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FvfMYvxWifMNbsQtngPsLimKYyt6BidNQSparCFrm.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the next few questions i tend to answer Y to them all. as i don't want anonymous users, remote root logins or a test DB and finally we need to reload the privileges table. Now your can login to MySQL with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mysql -u root 

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

&lt;/div&gt;



&lt;p&gt;And thats it for MySQL. You can now create new users and tables etc for use, or if you're feeling really spicy install something like phpmyadmin or create a remote user that can hit the server with MySQL Workbench.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install PHP
&lt;/h3&gt;

&lt;p&gt;Nginx is slightly different to Apache, which comes with PHP support out of the box, for Nginx there is a few little bits we need to install or we aren't going anywhere. &lt;code&gt;PHP-FPM&lt;/code&gt;and &lt;code&gt;PHP-MYSQL&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install php-fpm php-mysql

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

&lt;/div&gt;



&lt;p&gt;Accept any prompts that come up, and that's it for your LEMP environment, You can find NGNIX configs online which you need to put into your &lt;code&gt;/etc/nginx/sites-available/&lt;/code&gt; i'm going to write a post on the configs themselves at some point as its a big subject.&lt;/p&gt;

&lt;p&gt;for the examples im going to use a mikej directory as the example for the next bit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Certbot
&lt;/h3&gt;

&lt;p&gt;Certbot is great as it works for both Nginx and Apache, how i hadnt heard of it before this week il never know. simply head over to &lt;a href="https://certbot.eff.org/lets-encrypt/" rel="noopener noreferrer"&gt;Cerbot Installation page&lt;/a&gt; and pick the OS you're using for installation instructions. in my instance its Ubuntu 20.04. then run the commands from the guide. Mine were:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo snap install --classic certbot
﻿
sudo ln -s /snap/bin/certbot /usr/bin/certbot

sudo certbot --nginx

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

&lt;/div&gt;



&lt;p&gt;the final command will pop up with some questions like below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2F6xm8UyhvuH0YwfnXEFq71CDDXcuTYZk4oSCoAnRP.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2F6xm8UyhvuH0YwfnXEFq71CDDXcuTYZk4oSCoAnRP.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;so in the prompt i'm going to type &lt;code&gt;5,6&lt;/code&gt; for &lt;strong&gt;mikej.rocks&lt;/strong&gt; and &lt;strong&gt;&lt;a href="http://www.mikej.rocks" rel="noopener noreferrer"&gt;www.mikej.rocks&lt;/a&gt;&lt;/strong&gt; and hit enter. if your doing more than one site it make take a short while to finish but what its essentially doing is... calling for a new cert from LetsEncrypt and editing your Nginx config file... yep that's right you don't have to do a thing! When it finishes you should see the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FFgOzNX4fIfNvNoGxIUeLFjZqEhMRYLEavQkWJw7M.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FFgOzNX4fIfNvNoGxIUeLFjZqEhMRYLEavQkWJw7M.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it.... if you visit your site now, it will have an SSL Certificate installed and just work!.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final word!
&lt;/h3&gt;

&lt;p&gt;If you found this tutorial helpful please consider following me on twitter &lt;a href="https://twitter.com/skino2020" rel="noopener noreferrer"&gt;@skino2020&lt;/a&gt; for more updates on my blog. And if you really found it helpful, why not buy me a Coffee, Beer or Pizza &lt;a href="https://www.buymeacoffee.com/skino2020" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;Mike&lt;br&gt;&lt;br&gt; &lt;/p&gt;
&lt;h2&gt;Raspada-Blog&lt;/h2&gt;  I post on my blog primarily and share the posts via API, please check out &lt;a href="//www.raspada-blog.co.uk"&gt;Raspada-Blog&lt;/a&gt; for more posts and information. If you have any questions please message me on twitter or use my website contact form.

</description>
      <category>server</category>
      <category>nginx</category>
      <category>certbot</category>
    </item>
    <item>
      <title>Ubuntu Nice to have's</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Thu, 11 Nov 2021 20:38:06 +0000</pubDate>
      <link>https://forem.com/skino2020/ubuntu-nice-to-haves-22cn</link>
      <guid>https://forem.com/skino2020/ubuntu-nice-to-haves-22cn</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I've posted before on setting up PHP development environments on various Linux, but I've never really gone over the "Nice to haves" i like when working with.&lt;/p&gt;

&lt;p&gt;So today were going to go through the steps i take to get my system working how i like it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Some Prerequisites
&lt;/h3&gt;

&lt;p&gt;So as with every software installation on Linux we want to update our repositories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get update
sudo apt-get upgrade

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

&lt;/div&gt;



&lt;p&gt;with that done, lets get onto git, zsh &amp;amp; OhMyZsh﻿&lt;/p&gt;

&lt;h3&gt;
  
  
  Git, ZSH, OhMyZsh
&lt;/h3&gt;

&lt;p&gt;Git is installed as simply as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install git

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

&lt;/div&gt;



&lt;p&gt;You will get the usual:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;After this operation, 20.3 MB of additional disk space will be used.&lt;/p&gt;

&lt;p&gt;Do you want to continue? [Y/n] y&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Just select &lt;code&gt;Y&lt;/code&gt; and the installation will complete.&lt;/p&gt;

&lt;p&gt;next we need to install ZSH which again is just another single command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install zsh

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

&lt;/div&gt;



&lt;p&gt;With that done onto OhMyZsh, This one has a few more commands but again, nothing crazy. To start with were going to make some changes to our terminal, We need to get some fonts so the theme we will install for OhMyZsh will work properly.&lt;/p&gt;

&lt;p&gt;Download and install these font:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf" rel="noopener noreferrer"&gt;MesloLGS NF Regular.ttf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf" rel="noopener noreferrer"&gt;MesloLGS NF Bold.ttf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf" rel="noopener noreferrer"&gt;MesloLGS NF Italic.ttf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf" rel="noopener noreferrer"&gt;MesloLGS NF Bold Italic.ttf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once installed you will need to tell the terminal to use the MesloNG, To do this simply click on the burger menu and click &lt;strong&gt;Preferences&lt;/strong&gt; like so.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FFjhBIyXs47GtDT8RSdEzdllNM0nJEz2dgamlVorI.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FFjhBIyXs47GtDT8RSdEzdllNM0nJEz2dgamlVorI.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When the preferences is open click on the &lt;strong&gt;"Unnamed"&lt;/strong&gt; Option in the left panel, Click the &lt;strong&gt;Custom Fonts radio button&lt;/strong&gt; and then select &lt;strong&gt;MesloLGS NF&lt;/strong&gt; like below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FsIdVQPnu0BGsEDhopb6v0hVrpIRAgzERjlmyAUQt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FsIdVQPnu0BGsEDhopb6v0hVrpIRAgzERjlmyAUQt.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now onto cloning &lt;strong&gt;OhMyZsh&lt;/strong&gt; and then installing Powerlevel10k to customize the look and feel of our Terminal. First Lets clone OhMyZsh.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

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

&lt;/div&gt;



&lt;p&gt;If you get a CURL is not installed error simply run.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install curl

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

&lt;/div&gt;



&lt;p&gt;When you first install it will ask you if you want to set the default shell to zsh select Y and press enter. This will set the shell as Default and then add a .zshrc to your ~/ directory. if all goes well you should see the below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FC6vVymh4Bp0vLEhKjCaMsxlKBGcAy9kJfAWnLDzB.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FC6vVymh4Bp0vLEhKjCaMsxlKBGcAy9kJfAWnLDzB.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nice!, now some people like what they see here and don't mind the -&amp;gt; ~ prompt, but i like to tart it up a bit with Powerlevel10k. To install p10k simply run the following from 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;git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

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

&lt;/div&gt;



&lt;p&gt;this will clone the theme to our machine and we just need to tell zsh/OhMyZsh to use the powerlevel10k theme. To do this, we need to edit the .zshrc file i mentioned earlier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano ~/.zshrc

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

&lt;/div&gt;



&lt;p&gt;You should now see the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Ft5fQx02GLjsL4ubmQgzWw6S6ja67OJqUMI838LwG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Ft5fQx02GLjsL4ubmQgzWw6S6ja67OJqUMI838LwG.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to edit the ZSH_THEME bit and change it from:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ZSH_THEME="robbyrussell"&lt;/code&gt; to &lt;code&gt;ZSH_THEME="powerlevel10k/powerlevel10k"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once done hit the key combination &lt;strong&gt;Ctrl + X&lt;/strong&gt;, type &lt;strong&gt;Y&lt;/strong&gt; and then hit &lt;strong&gt;Enter this will save the file and bring you back to the same terminal prompt from earlier. We now need to refresh the config so we can start using powerlevel10k&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;source ~/.zshrc

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

&lt;/div&gt;



&lt;p&gt;Once you source the .zshrc you will immediately be directed to the p10k setup. there is many many different alterations you can choose but I'll show you mine. The first few questions are just ensuring the terminal is using the custom fonts etc. The following few questions for me are all &lt;strong&gt;Y&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Does this look like a diamond (rotated square)?&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Does this look like a lock?&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Does this look like a Debian logo (swirl/spiral)?&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Do all these icons fit between the crosses?&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we get to the actual configuring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prompt Style - &lt;strong&gt;(3) Rainbow&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Character Set - &lt;strong&gt;(1) Unicode&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Show Current Time - &lt;strong&gt;(1) No&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Prompt Separators - &lt;strong&gt;(1) Angled&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Prompt Heads - &lt;strong&gt;(1) Sharp&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Prompt Tails - &lt;strong&gt;(1) Flat&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Prompt Height - &lt;strong&gt;(2) Two Lines&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Prompt Connection - &lt;strong&gt;(2) Dotted&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Prompt Frame - &lt;strong&gt;(2) Left&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Connection and Frame color - &lt;strong&gt;(4) Darkest&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Prompt Spacing - &lt;strong&gt;(2) Sparse&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Icons - &lt;strong&gt;(2) Many Icons&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Prompt Flow - &lt;strong&gt;(1) Concise&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Enable Transient Prompt - &lt;strong&gt;(n) No&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Instant Prompt Mode - &lt;strong&gt;(1) Verbose (Recommended)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Apply Changes to ~/.zshrc - (y) Yes &lt;strong&gt;(Recommended)&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;That is the final question and if you have done everything correct you should be faced with the following prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2F5F95peBd0xz3bpWdSWYyvkFZ9A4hXlXBcOWJdOYq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2F5F95peBd0xz3bpWdSWYyvkFZ9A4hXlXBcOWJdOYq.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All of these changes are subject to your preferences, i work a lot in the Terminal so i like it to get out of the way and look clean.&lt;/p&gt;

&lt;p&gt;We can leave the terminal as it is now..... or we can add two plugins to our install to make your life so much easier!&lt;/p&gt;

&lt;p&gt;First we need to CD into the OhMyZsh Plugin Directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~/.oh-my-zsh/plugins/

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

&lt;/div&gt;



&lt;p&gt;This path may differ depending on what Distro of Linux you are using, For this tutorial i have been using Ubuntu.&lt;/p&gt;

&lt;p&gt;On a side note... how cool does our terminal look when navigating through directories:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FszfiLCDx5VVNUU1kKD0RxdbSCCBKffD6UMBRM7yO.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FszfiLCDx5VVNUU1kKD0RxdbSCCBKffD6UMBRM7yO.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Anyway, to our first plugin Auto Suggestions. This can be cloned into our plugins directory by typing the following command into our terminal&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

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

&lt;/div&gt;



&lt;p&gt;This will pull the plugin down but not set it for use. we going to be installing two plugins so I'll go ahead and clone the second one before we edit the .zshrc&lt;/p&gt;

&lt;p&gt;The second plugin is Syntax Highlighting and its brilliant, sometimes when working in the terminal you type a command and you get the non helpful "failed - blah blah blah" messages.... well Syntax Highlighting will show up green if the syntax is correct and red if not... neat!&lt;/p&gt;

&lt;p&gt;In the plugins directory from terminal type the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

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

&lt;/div&gt;



&lt;p&gt;Now that we have both of our plugins downloaded lets set them in our .zshrc and source it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano ~/.zshrc
scroll down to the plugins bit:
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

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

&lt;/div&gt;



&lt;p&gt;were going to edit this to include two more plugins as well as the git one. It is essential that &lt;code&gt;zsh-syntax-highlighting&lt;/code&gt; is the last plugin to load, if it isn't it wont function as intended. Edit the plugin section like mine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
    git 
    zsh-autosuggestions
    zsh-syntax-highlighting
)

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

&lt;/div&gt;



&lt;p&gt;Once you have edited it like above, &lt;strong&gt;Ctrl + X&lt;/strong&gt;, &lt;strong&gt;Y&lt;/strong&gt; and &lt;strong&gt;Enter&lt;/strong&gt; to save and exit Nano. at the next prompt simply type:&lt;/p&gt;

&lt;p&gt;source ~/.zshrc&lt;/p&gt;

&lt;p&gt;Once that is done, as your typing the prompt will swap between red and green depending on if its correct or not.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Fav4OFH1FmfvodQTbAhdN6AUlmWCfOAWPNkchY7YV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Fav4OFH1FmfvodQTbAhdN6AUlmWCfOAWPNkchY7YV.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also notice in the first prompt above its suggesting in white what i can type next, if i was to hit my right arrow key it would complete for me, this saves me a ton of time!&lt;/p&gt;

&lt;p&gt;Some people will say i have gone to too great lengths to over complicate this terminal bit, but as i spend a lot of time in my terminal.... its worth it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install Chrome
&lt;/h3&gt;

&lt;p&gt;Yes we have Firefox, or we can install Chromium from the Software store.... but the just don't quite do it for me... i like chrome because i can sync all my settings and plugins across systems (i use 3 in total for work and home).&lt;/p&gt;

&lt;p&gt;There is a few ways to install it but my preference is through the terminal, its quick and easy.&lt;/p&gt;

&lt;p&gt;so if its not open already open your Terminal and type the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~/Downloads

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

&lt;/div&gt;



&lt;p&gt;and then&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

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

&lt;/div&gt;



&lt;p&gt;this will download the .deb to your downloads folder. once the download has completed, still in the Downloads directory type the following 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;sudo apt install ./google-chrome-stable_current_amd64.deb

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

&lt;/div&gt;



&lt;p&gt;And that's it Chrome is installed!&lt;/p&gt;

&lt;p&gt;Nice!&lt;/p&gt;

&lt;h3&gt;
  
  
  IDE's (Programming)
&lt;/h3&gt;

&lt;p&gt;Now out of the box you can go to the Software Center and Download VS Code or DBeaver for your code client and your MySQL client but I'm not a huge fan of them. They work and are great but as i dont need to pay for the software I'm about to install (im a student) i wont be going over them. if you want to you can simply go to the software center, search for them and click install.&lt;/p&gt;

&lt;p&gt;I prefer Jet Brains PHPstorm and Datagrip which i get free as a student.&lt;/p&gt;

&lt;p&gt;to install PHPstorm and DataGrip we do it through SNAP installations, dead easy and through the command line!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo snap install phpstorm --classic

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

&lt;/div&gt;



&lt;p&gt;and for DataGrip&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo snap install datagrip --classic

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

&lt;/div&gt;



&lt;p&gt;These take a few mins each to download and install but that's it, no config no dpkg etc it just does it all for you with snap!&lt;/p&gt;

&lt;h3&gt;
  
  
  Hit me up or Buy me a coffee
&lt;/h3&gt;

&lt;p&gt;if you found this post useful please consider following me on twitter &lt;a href="https://twitter.com/skino2020" rel="noopener noreferrer"&gt;@skino2020&lt;/a&gt; and if you found it really helpful consider buying me a coffee &lt;a href="https://www.buymeacoffee.com/skino2020" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Raspada-Blog
&lt;/h3&gt;

&lt;p&gt;I post on my blog primarily and share the posts via API, please check out &lt;a href="//www.raspada-blog.co.uk"&gt;Raspada-Blog&lt;/a&gt; for more posts and information. If you have any questions please message me on twitter or use my website contact form.&lt;/p&gt;

</description>
      <category>powerlevel10k</category>
      <category>zsh</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>LaraSlack By Tom Mountain</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Mon, 08 Nov 2021 22:36:42 +0000</pubDate>
      <link>https://forem.com/skino2020/laraslack-by-tom-mountain-4n97</link>
      <guid>https://forem.com/skino2020/laraslack-by-tom-mountain-4n97</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Occasionally i come across packages that are small but incredibly helpful. So this package I'm going to go over today was built by my work mate &lt;a href="https://twitter.com/tommountain_" rel="noopener noreferrer"&gt;@tommountain_&lt;/a&gt; the lead developer at the company we work at. The package itself is a simple Slack integration four your Laravel Project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lets get started!
&lt;/h3&gt;

&lt;p&gt;First off, we need to ensure we have Slack setup with the web hook ready to go, i wont go into the full detail of it but you can find the information here: &lt;a href="https://api.slack.com/messaging/webhooks" rel="noopener noreferrer"&gt;Slack Webhook API&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Essentially you need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a Channel&lt;/li&gt;
&lt;li&gt;Enable WebHooks&lt;/li&gt;
&lt;li&gt;Create a WebHook&lt;/li&gt;
&lt;li&gt;Use webhook (were going to be adding ours to the .env as per LaraSlack Docs)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, as with most packages, it can be installed with composer. The docs are nice and simple for the package also and can be checked out here: &lt;a href="https://github.com/ThomasMountain/laraslack" rel="noopener noreferrer"&gt;LaraSlack&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer require mountain/laraslack

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

&lt;/div&gt;



&lt;p&gt;If were following the doc's we then move onto adding the helper to our project. If your using the standard Laravel helpers.php just add the following lines to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function laraslack($content)
{
    return new \ThomasMountain\LaraSlack\LaraSlack($content);
}

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

&lt;/div&gt;



&lt;p&gt;Installation of package done! not to add the config items to our .env&lt;/p&gt;

&lt;h3&gt;
  
  
  .ENV Setup
&lt;/h3&gt;

&lt;p&gt;We can override some of the defaults but for the purpose of the tutorial were going to stick with the defaults:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SLACK_WEB_HOOK_URL="&amp;lt;Your Webhook Here&amp;gt;"
﻿SLACK_CHANNEL=@raspada-contact-form
SLACK_USERNAME="Raspada Contact Form"
﻿SLACK_ICON=:slightly_smiling_face:
SLACK_SEND=true

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

&lt;/div&gt;



&lt;p&gt;These are the minimum of what is required in the env.&lt;/p&gt;

&lt;h3&gt;
  
  
  So how do we use it?
&lt;/h3&gt;

&lt;p&gt;This is where it gets really fun, as you can be creative :D, for the standard integration you can simple do something like this &lt;em&gt;(I'm adding it to my contact form for when a message is sent).&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$slack_message = "You have had a message on the contact form. The sender address is " . $this-&amp;gt;email . " with a Subject of " . $this-&amp;gt;subject . " and the message is: " . $this-&amp;gt;comment;

\laraslack($slack_message);

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

&lt;/div&gt;



&lt;p&gt;No when the contact form is submitted, a slack message will be sent to my raspada-blog-contact channel like below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Frd9bXxrWwxeRjCb6zJQmgo5HBVWn8fIybowOUmMN.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Frd9bXxrWwxeRjCb6zJQmgo5HBVWn8fIybowOUmMN.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And there you have it, few mins and you have a basic Slack integration setup!&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Words
&lt;/h3&gt;

&lt;p&gt;I am going to be writing one up for Hashnode but I'm still ironing out a kink with the Tags submissions, The rest of the submission works perfectly... just not the tags. Also there may be cleaner ways to make these Functions but im still on my learning Journey.&lt;/p&gt;

&lt;p&gt;if you found this post useful please consider following me on twitter &lt;a href="https://twitter.com/skino2020" rel="noopener noreferrer"&gt;@skino2020&lt;/a&gt; and if you found it really helpful consider buying me a coffee &lt;a href="https://www.buymeacoffee.com/skino2020" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>easy</category>
      <category>php</category>
      <category>helpers</category>
    </item>
    <item>
      <title>Post to Dev.to &amp; Medium through API</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Tue, 19 Oct 2021 22:35:41 +0000</pubDate>
      <link>https://forem.com/skino2020/post-to-devto-medium-through-api-4778</link>
      <guid>https://forem.com/skino2020/post-to-devto-medium-through-api-4778</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Over the past year i have started to enjoy Blogging and hopefully soon Vlogging, but one thing has driven me crazy whilst trying to drive more traffic to my site and twitter page was copying and pasting my posts to Hashnode, Medium and Dev.to..... enough was enough, time to setup the API posting&lt;/p&gt;

&lt;p&gt;First of all i need to say thank you to someone and also acknowledge where i found some help in order to get the Dev.to API working with my Laravel application.&lt;/p&gt;

&lt;p&gt;So first of all thanks to &lt;a href="https://twitter.com/tommountain_" rel="noopener noreferrer"&gt;Tom&lt;/a&gt;, a work colleague of mine who is only just starting to look at tech Twitter but is an absolute genius of web development!, Tom helps me daily without being judgemental and can build absolutely anything with Laravel!, hes a top bloke and you can all expect amazing things from him!&lt;/p&gt;

&lt;p&gt;The second person i want to give credit to is &lt;a href="https://dev.to/codybontecou"&gt;Cody Bontecou&lt;/a&gt; for writing the article i came across for posting to Dev.To via API, although it didn't give me the how, it definitely gave me the where to find the info to post to Dev.to via API.&lt;/p&gt;

&lt;p&gt;So without wasting anymore time lets get into how to post to Dev.to from a Laravel Application at the click of a button!.&lt;/p&gt;

&lt;h3&gt;
  
  
  DEV.TO
&lt;/h3&gt;

&lt;p&gt;I've had two twitter accounts over the years... one that got hacked by someone who was pretending to be a very attractive Japanese woman looking for a "wealthy white man" to settle down with and my latest one. When i joined the "Tech Twitter" scene all i wanted to do was help people and learn from people... and a few of my first followers introduced me to &lt;a href="https://dev.towww,dev,to"&gt;Dev.to&lt;/a&gt;... i have since discovered Hashnode and Medium but Dev.to was "there for me" at the beginning so i'll be covering that first!&lt;/p&gt;

&lt;h3&gt;
  
  
  Lets get started!
&lt;/h3&gt;

&lt;p&gt;So first of all, Lets get our API keys from Dev.to go to at &lt;a href="https://dev.to/settings/account"&gt;https://dev.to/settings/account&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2F7o40HY8LkhlR7vZjaghqqaPqZ9NlKLzXX7HVwJgY.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2F7o40HY8LkhlR7vZjaghqqaPqZ9NlKLzXX7HVwJgY.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and scroll down to &lt;strong&gt;DEV Community API Keys&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FZkF5d7NIq7BXZR7ucbQPS3lGTcG7RqdU4fHaGqOi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FZkF5d7NIq7BXZR7ucbQPS3lGTcG7RqdU4fHaGqOi.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will need this soon.&lt;/p&gt;

&lt;p&gt;Now i could go through the testing stage of this API using the Insomnia app but i'm going straight into the Laravel bit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Livewire Component
&lt;/h3&gt;

&lt;p&gt;I'm using Livewire as i want to be able to add some more components to the admin page i'm setting up.&lt;/p&gt;

&lt;p&gt;so open up your terminal and type:&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 livewire:make SocialPosts

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(I'm calling it SocialPost.php as we will expand to use Hashnode and Medium in the same controller)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This will make you a view and a controller.... in this tutorial we are going to look at the Controller more than the view... you can do what ever you want with the view, but the Controller follows a pretty solid process.&lt;/p&gt;

&lt;h3&gt;
  
  
  The View component...
&lt;/h3&gt;

&lt;p&gt;as previously stated this consists of two parts... a view and a Livewire controller. so in my Example i want to see the posts on my website that i can post to Dev.to....&lt;/p&gt;

&lt;p&gt;I'm using the amazing &lt;a href="https://github.com/themsaid/wink" rel="noopener noreferrer"&gt;Laravel Wink&lt;/a&gt; so i want to use that to grab my latest 3 posts and display them on my "admin page"&lt;/p&gt;

&lt;p&gt;the Livewire controller comes with a function as standard which is called render... this is the first function hit when the &lt;code&gt;&amp;lt;livewire:dev-to-posts/&amp;gt;&lt;/code&gt; is called, and the information displayed is based on the content of the "render" function.&lt;/p&gt;

&lt;p&gt;so here is the view i get when i log into my admin screen on my blog.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FXPcu5ZTDW4nziHFygLm7JotXLg7t4AHxSBy8B3we.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FXPcu5ZTDW4nziHFygLm7JotXLg7t4AHxSBy8B3we.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and the controller function to do this is incredibly simple and looks 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;public function render()
{
    $latestPost = WinkPost::with("tags")
        -&amp;gt;live()
        -&amp;gt;orderBy("publish_date", "DESC")
        -&amp;gt;simplePaginate(3);
    return view('livewire.dev-to-posts', [
        "posts" =&amp;gt; $latestPost,
    ]);
}

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

&lt;/div&gt;



&lt;p&gt;So what's this function doing?&lt;/p&gt;

&lt;p&gt;Well quite simply its looking for all WinkPost with Tags that are live (Published) and orders it by the latest post first and then paginates it by 3 posts.&lt;/p&gt;

&lt;p&gt;It the returns the view with the &lt;code&gt;$posts&lt;/code&gt; variable.&lt;/p&gt;

&lt;p&gt;The front end is just as simple... We simply &lt;a class="mentioned-user" href="https://dev.to/foreach"&gt;@foreach&lt;/a&gt; through the posts passed through to the blade and display the posts to the admin, the Blade code is as follows &lt;em&gt;(i have removed the classes as they are all custom tailwind classes and would be irrelevant to this tutorial). Also i know the Anchor Tags don't have anything on them yet, were going to update that shortly.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@foreach($posts as $post)
    &amp;lt;section class="mb-2 mt-2"&amp;gt;
        &amp;lt;div&amp;gt;
            &amp;lt;div class="flex flex-wrap"&amp;gt;
                &amp;lt;div class="w-full lg:w-3/4"&amp;gt;
                    &amp;lt;div class="relative flex flex-col h-full lg:p-6 "&amp;gt;
                        &amp;lt;h3&amp;gt;
                            {{ $post-&amp;gt;title }}
                        &amp;lt;/h3&amp;gt;
                        &amp;lt;div class="flex flex-row"&amp;gt;
                            &amp;lt;p class="pb-6 text-white text-justify"&amp;gt;{{ $post-&amp;gt;excerpt }}&amp;lt;/p&amp;gt;
                        &amp;lt;/div&amp;gt;
                        &amp;lt;div class="flex flex-row"&amp;gt;
                            &amp;lt;p class="pb-6 text-fuchsia-400 text-justify"&amp;gt;{{ implode(', ', $post-&amp;gt;tags-&amp;gt;map-&amp;gt;name-&amp;gt;toArray()) }}&amp;lt;/p&amp;gt;
                        &amp;lt;/div&amp;gt;

                        &amp;lt;div class="flex flex-wrap items-center mt-4 "&amp;gt;
                                &amp;lt;a href="#" &amp;gt;
                                    ﻿Post to Dev.tp&amp;lt;/a&amp;gt;
                                &amp;lt;a href="#" &amp;gt;
                                    Post to Medium&amp;lt;/a&amp;gt;
                                &amp;lt;a href="#" &amp;gt;
                                    Post to Hashnode&amp;lt;/a&amp;gt;
                            &amp;lt;/div&amp;gt;
                        &amp;lt;/div&amp;gt;
                    &amp;lt;/div&amp;gt;

                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/section&amp;gt;
    @endforeach

    &amp;lt;div class="mx-auto mb-8"&amp;gt;{{ $posts-&amp;gt;links() }}&amp;lt;/div&amp;gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Whats being passed through?
&lt;/h3&gt;

&lt;p&gt;So lets dd the $post variable in the view to see what were actually getting.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;({{ dd(posts) }})

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

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FXzFYfXq6sFnFTP0nyKCp4kojDvDOer9G7PaubFx6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FXzFYfXq6sFnFTP0nyKCp4kojDvDOer9G7PaubFx6.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So the DD is bringing back a collection of post arrays which include all of the info required to display, excerpts, Cover image and Title ETC. We need to foreach through them in order to get the individual information, as a completely un-styled example you can do the following in your blade;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@foreach($posts as $post)
    {{ $post-&amp;gt;title }}
    {{ $post-&amp;gt;excerpt }}
    {{ $post-&amp;gt;slug }}
    {{ implode(', ', $post-&amp;gt;tags-&amp;gt;map-&amp;gt;name-&amp;gt;toArray()) }}
@endforeach

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

&lt;/div&gt;



&lt;p&gt;If i DD the above $post variables inside the foreach i get the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Elementary OS - Dev Environment Setup"

"So every now and then i see something that catches my eye. Recently that seems to be Linux Distributions, over the last few months i have changed my distribution's a few times to try and find one i'm comfortable with. I moved from my iMac (getting a bit sluggish) to Ubuntu originally and it worked but i didn't "enjoy it", i then tried Manjaro, then Pop!_OS and then finally thought id have a go with Elementary OS. ◀"

"valet-linux-elementary-os"

"Linux, PHP, MySQL"

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note: I'm using&lt;/em&gt; &lt;a href="https://github.com/themsaid/wink" rel="noopener noreferrer"&gt;&lt;em&gt;Laravel Wink&lt;/em&gt; &lt;/a&gt;&lt;em&gt;by&lt;/em&gt; &lt;a href="https://github.com/themsaid" rel="noopener noreferrer"&gt;&lt;em&gt;Mohamed Said&lt;/em&gt;&lt;/a&gt; &lt;em&gt;and its brilliant, it takes out the stress of building the blog functionality yourself (although that is quite fun to do also :P)&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The buttons
&lt;/h3&gt;

&lt;p&gt;For the buttons we are going to "Livewire them up" to make it easier to call a Public function from our Livewire controller which also means we don't need the Routes in the web.php file.&lt;/p&gt;

&lt;p&gt;So i want the Post to DEV.TO button to call a function and post to DEV.TO, so i'll name the button now and make my controller function to match it next, Also from the previous DD we saw that the slug was available in the $post variable which were going to use to pass the slug/id through to the Livewire Function when we click "Post to DEV.TO"&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;button wire:click="postToDevTo('{{ $post-&amp;gt;slug }}')"
        class="inline-flex items-center px-6 py-3 text-base font-semibold md:mb-2 lg:mb-0"&amp;gt;
    Post to DEV.TO
&amp;lt;/button&amp;gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Lets make a service...
&lt;/h3&gt;

&lt;p&gt;i decided i didn't want to add the API key directly to my Controller and decided to add it as a Config Item.. so how do we do this? simple.. open up the services.php from the &lt;code&gt;config/services.php&lt;/code&gt; and add the following lines&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'devto' =&amp;gt; [
    'api-key' =&amp;gt; env('DEV_TO_API_KEY'),
],

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

&lt;/div&gt;



&lt;p&gt;and then in your .env file add the following line to the bottom:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DEV_TO_API_KEY="yourDev.TO API key from earlier"

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

&lt;/div&gt;



&lt;p&gt;that's your Config item set up!&lt;/p&gt;

&lt;h3&gt;
  
  
  Next, Lets build our function!
&lt;/h3&gt;

&lt;p&gt;The three Functions we will eventually build will be fairly similar across the board, with the exception of the Hashnode API which uses GraphQL and requires a bit of work to be used with Guzzle.&lt;/p&gt;

&lt;p&gt;So to start with when we made the button with the wire:click we past the $post-&amp;gt;slug to the function which means we can just call $slag inside our SocialPosts.php like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function postToDevTo($slug)
{
  // Code will go here
}

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

&lt;/div&gt;



&lt;p&gt;Now that we have the function and the slug we can start building everything up.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$post      = WinkPost::whereSlug($slug)-&amp;gt;firstOrFail();
$postImg   = "https://www.raspada-blog.co.uk" . $post-&amp;gt;featured_image;
$converter = new HtmlConverter();
$converter-&amp;gt;getConfig()-&amp;gt;setOption('strip_tags', true);
$postBody = $post-&amp;gt;body;
$stringsReplaced = sanitizeBody($postBody);
$markdown = $converter-&amp;gt;convert($stringsReplaced);

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

&lt;/div&gt;



&lt;p&gt;So whats happening?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;$post&lt;/code&gt; is grabbing all information about the post using the &lt;code&gt;$slug&lt;/code&gt; as its reference.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$postImg&lt;/code&gt; is building up the URL for the image, so when we pass it over to Dev.to it displays correctly.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$converter&lt;/code&gt; - Im using this as when i build my site i set Wink to use Rich text instead of markdown which is HTML in the DB and i need Markdown for all 3 other blogging platforms. You can checkout the converter i used here if you need it: &lt;a href="https://github.com/thephpleague/html-to-markdown" rel="noopener noreferrer"&gt;https://github.com/thephpleague/html-to-markdown&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$converter-&amp;gt;getConfig()-&amp;gt;setOption(&lt;/code&gt;&lt;code&gt;'strip_tags'&lt;/code&gt;&lt;code&gt;,&lt;/code&gt;&lt;code&gt;true&lt;/code&gt;&lt;code&gt;);&lt;/code&gt; is just telling the Converter to strip out any standard tags.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$postBody = $post-&amp;gt;body&lt;/code&gt; is just making it a sing array instead of a key pair as I'll be passing it to my helper next.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$stringReplaced&lt;/code&gt; is going to be the variable for my sanitizeBody Helper (I'll add the contents of my helper below.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$markdown&lt;/code&gt; is used to turn the HTML code left into Markdown with the converter.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the weird things i learnt when trying to work with the converter and the Rich Text editor was, the converter didn't always strip the tags out. This meant i needed to do a SHED load if str_replace (17 in total)... and this just looked a bit horrible in my controller, so i added it to my helpers.php file, if you want to use my helper the code is below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (!function_exists('sanitizeText')) {
    function sanitizeBody($postBody)
    {
        $html1    = str_replace("src=\"/storage/wink", 'src="https://www.raspada-blog.co.uk/storage/wink', $postBody);
        $html2    = str_replace('&amp;lt;pre class="ql-syntax" spellcheck="false"&amp;gt;', ' ', $html1);
        $html3    = str_replace('&amp;lt;span class="hljs-keyword"&amp;gt;', '', $html2);
        $html4    = str_replace('&amp;lt;span class="hljs-string"&amp;gt;', '', $html3);
        $html5    = str_replace('&amp;lt;span class="hljs-meta"&amp;gt;', '', $html4);
        $html6    = str_replace('&amp;lt;span class="hljs-title"&amp;gt;', '', $html5);
        $html7    = str_replace('&amp;lt;/span&amp;gt;', '', $html6);
        $html8    = str_replace('', ' ', $html7);
        $html9    = str_replace('&amp;lt;span class="hljs-class"&amp;gt;', '', $html8);
        $html10   = str_replace('&amp;lt;span class="hljs-function"&amp;gt;', '', $html9);
        $html11   = str_replace('&amp;lt;span class="hljs-params"&amp;gt;', '', $html10);
        $html12   = str_replace('&amp;lt;span class="hljs-number"&amp;gt;', '', $html11);
        $html13   = str_replace('&amp;lt;span class="hljs-attr"&amp;gt;', '', $html12);
        $html14   = str_replace('&amp;lt;span class="hljs-attribute"&amp;gt;', '', $html13);
        $html15   = str_replace('&amp;lt;span class="hljs-built_in"&amp;gt;', '', $html14);
        $html16   = str_replace('&amp;lt;span class="hljs-variable"&amp;gt;', '', $html15);
        $html17   = str_replace('&amp;lt;span class="hljs-comment"&amp;gt;', '', $html16);
        return $html17;
    }
}

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

&lt;/div&gt;



&lt;p&gt;Gross isn't it! But it makes my controller look neater.&lt;/p&gt;

&lt;h3&gt;
  
  
  Now onto the API
&lt;/h3&gt;

&lt;p&gt;Were going to be using GuzzleHttp to send our post across to Dev.to. This is probably the most difficulty i had in posting to dev.to with the API because i didn't know how to use Guzzle... but essentially its split into two parts...the header with the API key and content type and then the main JSON payload.&lt;/p&gt;

&lt;p&gt;The payload itself was pretty simple to work with as soon as you understand how Guzzle/http uses json.&lt;/p&gt;

&lt;p&gt;you need to specify the client with the headers and then the response with some sections in it, Mainly telling guzzle its JSON.... i missed this out when trying to do it originally. but reading through the Guzzle Docs i got there in the end.&lt;/p&gt;

&lt;p&gt;The standard parts required to post to Dev.To are &lt;strong&gt;Title, Published, body_markdown, main_image&lt;/strong&gt; and &lt;strong&gt;Tags,&lt;/strong&gt; and in Laravel when you put it all together you get this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$client   = (new \GuzzleHttp\Client([
    'headers' =&amp;gt; [
        "api-key"      =&amp;gt; config('services.devto.api-key'),
        "Content-Type" =&amp;gt; "application/json"
    ]
]));
$response = $client-&amp;gt;post('https://dev.to/api/articles',
    ['json' =&amp;gt;
         ["article" =&amp;gt;
              [
                  "title"         =&amp;gt; $post-&amp;gt;title,
                  "published"     =&amp;gt; true,
                  "body_markdown" =&amp;gt; $markdown,
                  "main_image"    =&amp;gt; $postUrl,
                  "tags"          =&amp;gt; [implode(', ', $post-&amp;gt;tags-&amp;gt;map-&amp;gt;name-&amp;gt;toArray())]
              ]
         ]
    ]
);

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

&lt;/div&gt;



&lt;p&gt;Now if you look at the request above, you can see the API Config item we setup earlier.&lt;/p&gt;

&lt;p&gt;Now put it all together and you get&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function postToDevTo($slug)
{
    $post      = WinkPost::whereSlug($slug)-&amp;gt;firstOrFail();
    $postImg   = "https://www.raspada-blog.co.uk" . $post-&amp;gt;featured_image;
    $converter = new HtmlConverter();
    $converter-&amp;gt;getConfig()-&amp;gt;setOption('strip_tags', true);
    $postBody = $post-&amp;gt;body;
    $stringsReplaced = sanitizeBody($postBody);
    $markdown = $converter-&amp;gt;convert($stringsReplaced);

    $client   = (new \GuzzleHttp\Client([
        'headers' =&amp;gt; [
            "api-key"      =&amp;gt; config('services.devto.api-key'),
            "Content-Type" =&amp;gt; "application/json"
        ]
    ]));
    $response = $client-&amp;gt;post('https://dev.to/api/articles',
        ['json' =&amp;gt;
             ["article" =&amp;gt;
                  [
                      "title"         =&amp;gt; $post-&amp;gt;title,
                      "published"     =&amp;gt; true,
                      "body_markdown" =&amp;gt; $markdown,
                      "main_image"    =&amp;gt; $postImg,
                      "tags"          =&amp;gt; [implode(', ', $post-&amp;gt;tags-&amp;gt;map-&amp;gt;name-&amp;gt;toArray())]
                  ]
             ]
        ]
    );
    toastr()-&amp;gt;success('Success, Posted to Dev.to');
    return redirect()-&amp;gt;to('/admin');
}

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

&lt;/div&gt;



&lt;p&gt;Now when you click the button for "Post to DevTo" it will hit the function we have built and send the post across.&lt;/p&gt;

&lt;h3&gt;
  
  
  Medium API
&lt;/h3&gt;

&lt;p&gt;The initial setup of the Function is exactly the same as the devto one the only difference is you need to get your Author ID from an API call first. I use Insomnia client to test with usually as its easy to use, you can use whichever client suits your needs.&lt;/p&gt;

&lt;p&gt;With your client you need to make a GET Request from the &lt;strong&gt;&lt;a href="https://api.medium.com/v1/me" rel="noopener noreferrer"&gt;https://api.medium.com/v1/me&lt;/a&gt;&lt;/strong&gt; endpoint with a few extra bits. Using Insomnia as my example i add a Header of Content-Type with a value of application/json (see screenshot)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FH3Qhzd9oqdr80ENnLudKLmr1VwQsEgVa0WrEWDNK.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FH3Qhzd9oqdr80ENnLudKLmr1VwQsEgVa0WrEWDNK.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now before we move on to the Bearer Tap be need to go grab our access token from Mediums website. Simply login to you account, Click on your avatar top right and select settings from the drop-down. Once the page loads, scroll down to the integration token section and generate your token.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FttOPYnpBNIV1v0Xc3ceiyIWKX0MyS5HCbvg5JMCW.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.raspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FttOPYnpBNIV1v0Xc3ceiyIWKX0MyS5HCbvg5JMCW.jpg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the generated token as we will need that in a second.&lt;/p&gt;

&lt;p&gt;Back in Insomnia Click on the "Auth" tab and it will display a drop-down for you. From this list, Select Bearer. All you need to do here is paste the long integration token from Mediums website into the TOKEN field and then press send.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "data": {
    "id": "THIS-IS-YOUR-AUTHOR-ID",
    "username": "itmike2018",
    "name": "Mike Jones",
    "url": "https://medium.com/@itmike2018",
    "imageUrl": "https://cdn-images-1.medium.com/fit/c/400/400/0*KG_bikEM6ojnAGif"
  }
}

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

&lt;/div&gt;



&lt;p&gt;the only thing we need from this is the id which is what we will use in the next stage of posting to Medium.&lt;/p&gt;

&lt;p&gt;For the sake of Time i'm going to post the entire function for Medium here as i think you'll get the idea from what we discussed previously.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function postToMedium($slug)
{
    $post      = WinkPost::whereSlug($slug)-&amp;gt;firstOrFail();
    $converter = new HtmlConverter();
    $converter-&amp;gt;getConfig()-&amp;gt;setOption('strip_tags', true);
    $postBody = $post-&amp;gt;body;
    $stringsReplaced = sanitizeBody($postBody);
    $markdown = $converter-&amp;gt;convert($stringsReplaced);

    $client   = (new \GuzzleHttp\Client([
        'headers' =&amp;gt; [
            "Authorization" =&amp;gt; 'Bearer ' . config('services.medium.bearer'),
            "Content-Type"  =&amp;gt; "application/json"
        ]
    ]));
    $response = $client-&amp;gt;post('https://api.medium.com/v1/users/THIS-IS-YOUR-AUTHOR-ID/posts',
        ['json' =&amp;gt;
             [
                 "title"         =&amp;gt; $post-&amp;gt;title,
                 "contentFormat" =&amp;gt; 'markdown',
                 "content"       =&amp;gt; $markdown,
                 "tags"          =&amp;gt; [implode(', ', $post-&amp;gt;tags-&amp;gt;map-&amp;gt;name-&amp;gt;toArray())
                 ]
             ]
        ]
    );
    toastr()-&amp;gt;success('Success, Posted to medium!');
    return redirect()-&amp;gt;to('/admin');
}

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

&lt;/div&gt;



&lt;p&gt;In order to submit your post to medium you need to make a POST request to &lt;strong&gt;&lt;a href="https://api.medium.com/v1/users/YOUR-AUTHOUR-ID/posts" rel="noopener noreferrer"&gt;https://api.medium.com/v1/users/YOUR-AUTHOUR-ID/posts&lt;/a&gt;&lt;/strong&gt; changing out the &lt;strong&gt;YOUR-AUTHOUR-ID&lt;/strong&gt; with the ID we got earlier on.&lt;/p&gt;

&lt;p&gt;And that's it! as you can see i added the bearer token to a config item also to make things look a little neater.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Words
&lt;/h3&gt;

&lt;p&gt;I am going to be writing one up for Hashnode but I'm still ironing out a kink with the Tags submissions, The rest of the submission works perfectly... just not the tags. Also there may be cleaner ways to make these Functions but im still on my learning Journey.&lt;/p&gt;

&lt;p&gt;if you found this post useful please consider following me on twitter &lt;a href="https://twitter.com/skino2020" rel="noopener noreferrer"&gt;@skino2020&lt;/a&gt; and if you found it really helpful consider buying me a coffee &lt;a href="https://www.buymeacoffee.com/skino2020" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravelwink</category>
    </item>
    <item>
      <title>10 USEFUL LINUX COMMANDS!</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Wed, 29 Sep 2021 16:17:40 +0000</pubDate>
      <link>https://forem.com/skino2020/10-useful-linux-commands-pbg</link>
      <guid>https://forem.com/skino2020/10-useful-linux-commands-pbg</guid>
      <description>&lt;h2&gt;
  
  
  New to linux?
&lt;/h2&gt;

&lt;p&gt;I'm someone who is now using Linux as my main OS but remember quite well how difficult it was to get my head around the workings of Linux my first few weeks.&lt;/p&gt;

&lt;p&gt;So today i'm going to share a number of helpful commands to get you on your way!&lt;/p&gt;

&lt;h3&gt;
  
  
  cd (Change Directory)
&lt;/h3&gt;

&lt;p&gt;Does exactly what it says on the tin.... it helps you change your directory in the company line. So for example, if you want to go into your download directory you can do the following;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /home/username/Downloads/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can also  use  the shorthand  version;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~/Downloads
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The important bit of the second command is the ~ and the /&lt;/p&gt;

&lt;p&gt;The tilde (~) is the Linux shortcut for the home directory whereas ~/ references the start of a directory in the logged in users folder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FXKZfnDb59WuQumFYNXCXpNcdJDMtAMqeTgmtD4Qh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FXKZfnDb59WuQumFYNXCXpNcdJDMtAMqeTgmtD4Qh.jpg" alt="Output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to go back 1 folder? you can do the following instead of typing the whole path again:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FLYtcfYkXkf11sPniZl0AhFfec1PzKccR5jS5K99p.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FLYtcfYkXkf11sPniZl0AhFfec1PzKccR5jS5K99p.jpg" alt="Output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  ls (List)
&lt;/h3&gt;

&lt;p&gt;I use this an awful lot on my server when navigating through folders to see if I'm in the right folder or not. Another thing i tend to do is use the -l option on the command to get the permissions of the files and folders. the -l option essentially means show me the long format of the list with permissions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Fq0dRp1PyIk1vCJL9WFeZppaWOsd8iaGDSHWnG3Vz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Fq0dRp1PyIk1vCJL9WFeZppaWOsd8iaGDSHWnG3Vz.jpg" alt="Output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you take a look at 10 lines down in the above window it shows "total 8". What this is actually doing is counting the number of files in the 2 sub folders  &lt;strong&gt;&lt;em&gt;Example-Folder-1&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;Example-Folder-2&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There is a fair few more options for the list command like  &lt;code&gt;ls -r&lt;/code&gt;  which will display the files in reverse order or  &lt;code&gt;ls -S&lt;/code&gt;  which will sort the files by file size.&lt;/p&gt;

&lt;h3&gt;
  
  
  pwd (Print Work Directory)
&lt;/h3&gt;

&lt;p&gt;When it says Print it means to the terminal output not a piece of paper :P other than that.... it does exactly what it says on the tin.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2F79ZoJR3KVKGJV5NrNFNLI2CR7PLWjIzluffIJr9d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2F79ZoJR3KVKGJV5NrNFNLI2CR7PLWjIzluffIJr9d.jpg" alt="Output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I use this sometimes if i need to find out what the current directory is and run a command that requires the pull path.&lt;/p&gt;

&lt;h3&gt;
  
  
  mkdir &amp;amp; rmdir (Make and Remove directory)
&lt;/h3&gt;

&lt;p&gt;These 2 commands are great for quick editing through the terminal of folders.&lt;/p&gt;

&lt;p&gt;if you use the  &lt;code&gt;mkdir&lt;/code&gt;  command it will create a folder for you with the relevant file with  &lt;strong&gt;Read&lt;/strong&gt;,  &lt;strong&gt;Write&lt;/strong&gt;  &amp;amp;  &lt;strong&gt;Execute&lt;/strong&gt;  rights to your user and group and  &lt;strong&gt;Read&lt;/strong&gt;  &amp;amp;  &lt;strong&gt;Execute&lt;/strong&gt; for the "other". I'll be going through the file permissions in a future post so stay tuned.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FJeafT9psnTm4cFTBve6HBKi2wzJncda0TFnVgXoV.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FJeafT9psnTm4cFTBve6HBKi2wzJncda0TFnVgXoV.jpg" alt="Output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  shutdown
&lt;/h3&gt;

&lt;p&gt;I don't think this one needs much introduction but it does actually come with a few options.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo shutdown now
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This shuts down the computer right now.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo shutdown -r now
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This shuts down the computer in the correct manner and then restarts it again.&lt;/p&gt;

&lt;p&gt;Alternatively you can use:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo shutdown -r 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;which does the same thing.&lt;/p&gt;

&lt;p&gt;Want to schedule a shutdown? no problem the below command shuts down the PC in 15 minutes from when enter is hit on the command.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo shutdown -h 15
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;﻿ or if you want to shutdown at a specific time of the day you can do so by passing the 24 hour timestamp u want.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo shutdown 16:00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Mistype your shutdown schedule command? thats fine too... you can simply cancel it with the following command.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo shutdown -c
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  touch
&lt;/h3&gt;

&lt;p&gt;this is another handy command if you want to create empty files on your system, like if you want to create an empty text file you can do with this command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FEQj3ghGYdjm3Ob6ZuxwcSDPjYYlnQivlfcrTg6c5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FEQj3ghGYdjm3Ob6ZuxwcSDPjYYlnQivlfcrTg6c5.jpg" alt="Output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also use this to create files which are hidden as standard by the Linux OS (files starting with .)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FyyIUThPh198U5KpOxLV4N5eYTr75fvkcmIJfwpof.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FyyIUThPh198U5KpOxLV4N5eYTr75fvkcmIJfwpof.jpg" alt="Output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice that when i do the ls command the file is hidden but when i do the ls -a (all, shows hidden files) it displays the file we just created.&lt;/p&gt;
&lt;h3&gt;
  
  
  head &amp;amp; tail
&lt;/h3&gt;

&lt;p&gt;The commands are very hand if like me you are in and out of lots of text files in the Linux terminal. (Tail is the handier of the two)&lt;/p&gt;

&lt;p&gt;so i have generated a file with random text in it to demonstrate the following commands.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FptOMem1c9vRYql5OOn2oWipWnhRWfgXfI5GS5I8T.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FptOMem1c9vRYql5OOn2oWipWnhRWfgXfI5GS5I8T.jpg" alt="Output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see  from  the screenshot  when  you time  &lt;code&gt;head&lt;/code&gt;  the command looks at the first  10  lines  of  the file &lt;em&gt;(this is specified with the -n option)&lt;/em&gt;  the same is for the tail it starts at the tail end of the document and the number of lines is specified exactly the same as the head command with a -n&lt;/p&gt;

&lt;p&gt;I use tail a LOT on my web-server when i'm checking logs which in some cases can become thousands and thousands of lines long. Generally i only want to see the last 100 lines of a log (if you need more than that there is a serious problem :P) and what i do is output them lines to a text file on its own.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tail -n 100 headandtail.txt &amp;gt; lastonehundred.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Lets break the command down&lt;/p&gt;

&lt;p&gt;Look at the last 100 lines of the headandtail.txt file and output the result to lastonehundred.txt&lt;/p&gt;

&lt;h3&gt;
  
  
  mv  (MoVe)
&lt;/h3&gt;

&lt;p&gt;The move command is essentialy the cut tool from Windows it cuts/removes the file from its currently location and is output to the specified folder. in the previous example i tailed some text from headandtail.txt but meant to put it in the Example-Folder-1 so now i can use the mv command to do this, see screenshot below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FsLgXL24FNv3R6AncEiauUvKrbCiGIEJnCXGtWduM.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FsLgXL24FNv3R6AncEiauUvKrbCiGIEJnCXGtWduM.jpg" alt="Output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  cp (CoPy)
&lt;/h3&gt;

&lt;p&gt;This command goes hand in hand with the move command in some sense but it leave a "copy" in the location its already at. as an example il copy the file lastonehundred.txt file back to the root folder.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FHSmTrZ7WEIcANb7a9fPw6SsC1DHQvvvp4AV75kqa.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FHSmTrZ7WEIcANb7a9fPw6SsC1DHQvvvp4AV75kqa.jpg" alt="Output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  clear
&lt;/h3&gt;

&lt;p&gt;i mean this command is very simple but helps a lot when trying to focus in the terminal. type  &lt;code&gt;clear&lt;/code&gt;  in your terminal that has lots of terminal text going on and it will remove it all and give you a terminal as if you just opened it up.&lt;/p&gt;

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

&lt;p&gt;I hope these snippets have been helpful for you all! if you found this post useful please consider following me on twitter  &lt;a href="https://twitter.com/skino2020" rel="noopener noreferrer"&gt;@skino2020&lt;/a&gt;  and if you found it really helpful consider buying me a coffee  &lt;a href="https://www.buymeacoffee.com/skino2020" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Also please check out &lt;a href="//www.raspada-blog.co.uk"&gt;www.raspada-blog.co.uk&lt;/a&gt; for more tutorials!&lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>linux</category>
    </item>
    <item>
      <title>MYSQL FOR BEGINNERS! - PART TWO</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Wed, 29 Sep 2021 16:07:51 +0000</pubDate>
      <link>https://forem.com/skino2020/mysql-for-beginners-part-two-5eob</link>
      <guid>https://forem.com/skino2020/mysql-for-beginners-part-two-5eob</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;In our first tutorial we didn't actually do any data gathering, we just setup the environment and DB were working with. So in this tutorial we're going to grab some information from the DB!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FTEPjTPAJXTMJn7cmeFRlKEs77wZWc7rV7Mi6FBsd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FTEPjTPAJXTMJn7cmeFRlKEs77wZWc7rV7Mi6FBsd.jpg" alt="Schema" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Above you have the diagram of our Database. With the exception of Departments we have direct links between each table.&lt;/p&gt;

&lt;h3&gt;
  
  
  Something easy to start with
&lt;/h3&gt;

&lt;p&gt;So as were dealing with "Employee's" why not grab a list of the employee's.&lt;/p&gt;

&lt;p&gt;Now in MySQL and SQL in general you  &lt;strong&gt;SELECT&lt;/strong&gt;  data  &lt;strong&gt;FROM&lt;/strong&gt;  tables and that's exactly what we want to do here.&lt;/p&gt;

&lt;p&gt;We want to  &lt;strong&gt;SELECT&lt;/strong&gt;  data  &lt;strong&gt;FROM&lt;/strong&gt;  the employees table.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
    employees.emp_no,
    employees.birth_date,
    employees.first_name,
    employees.last_name,
    employees.gender,
    employees.hire_date
FROM
    employees
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Really simple stuff! but... can you see something annoying here?&lt;/p&gt;

&lt;p&gt;I've had to type  &lt;strong&gt;employees&lt;/strong&gt; 6 times whilst grabbing the data... so what can we do to combat this?&lt;/p&gt;

&lt;h3&gt;
  
  
  Aliasing
&lt;/h3&gt;

&lt;p&gt;Aliasing meas we give a table an  &lt;strong&gt;&lt;em&gt;"alias"&lt;/em&gt;&lt;/strong&gt;  when calling it in the select this becomes very handy when working with numerous tables and joins.&lt;/p&gt;

&lt;p&gt;To alias you simply need to assign the table a string of some sort (generally a single letter) in this instance were going to alias the table to  &lt;strong&gt;'e'.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
    e.emp_no,
    e.birth_date,
    e.first_name,
    e.last_name,
    e.gender,
    e.hire_date
FROM
    employees e
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Fz8K9F9mVQAys49FKOWRDWoJWPO41U4twdrYSR5rj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Fz8K9F9mVQAys49FKOWRDWoJWPO41U4twdrYSR5rj.jpg" alt="output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Much better! now when trying to access a column from a table i can type  &lt;strong&gt;&lt;em&gt;e.&lt;/em&gt;&lt;/strong&gt; And it will usually give me column options automatically, this is incredibly helpful when writing big SQL Statements.&lt;/p&gt;

&lt;p&gt;We can make the above table even easier to read. What if we want all columns out of a single table? and don't need any filtering? Simple, Use and  &lt;strong&gt;&lt;em&gt;Asterisk (*)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So instead of SELECT col1, col2, col3 etc etc we can do  &lt;strong&gt;&lt;em&gt;SELECT *&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;SQL:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
    *
FROM
    employees
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Fix3HPsbRtRxp19xwzoDD6RI1JesDXw0lVpua8WL7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2Fix3HPsbRtRxp19xwzoDD6RI1JesDXw0lVpua8WL7.jpg" alt="output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Exactly the same results as the previous SQL its worth mentioning that I've taken the alias off the employees for the second example as were only using a single table it doesn't really matter, but as you get to 2, 3, 4 and upward tables it becomes important.&lt;/p&gt;

&lt;h3&gt;
  
  
  How  many records!?
&lt;/h3&gt;

&lt;p&gt;As a little added extra i thought id give an option to the select before we finish. Lets say we want to count how many employee's work for the business... now you could  &lt;strong&gt;&lt;em&gt;Shift + Ctrl + Alt + A&lt;/em&gt;&lt;/strong&gt; (In DBEaver ayway) to bring back ALL records from that table, select the first column and see how many records there is.... or you can wrap the  &lt;strong&gt;Asterisk (*)&lt;/strong&gt;  in count brackets.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
    count(*)
FROM
    employees
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And the Result:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FDVGuVaJGpdZrmMKOLCOjEGxj3v7cAuOtesMGAriq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FDVGuVaJGpdZrmMKOLCOjEGxj3v7cAuOtesMGAriq.jpg" alt="Output" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;In this post we have looked at VERY basic database requests, next post we shall bring in another table and also SELECT aliasing.&lt;/p&gt;

&lt;p&gt;If you found this post useful please consider following me on twitter  &lt;a href="https://twitter.com/skino2020" rel="noopener noreferrer"&gt;@skino2020&lt;/a&gt;  for future updates to this series and if you found it really helpful consider buying me a coffee  &lt;a href="https://www.buymeacoffee.com/skino2020" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>mysql</category>
      <category>schema</category>
      <category>database</category>
    </item>
    <item>
      <title>MYSQL FOR BEGINNERS! - PART ONE</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Wed, 29 Sep 2021 16:01:02 +0000</pubDate>
      <link>https://forem.com/skino2020/mysql-for-beginners-part-one-2a50</link>
      <guid>https://forem.com/skino2020/mysql-for-beginners-part-one-2a50</guid>
      <description>&lt;p&gt;Intro&lt;br&gt;
MySQL is a huge part of the data world and often people are scared to get started, because they don't know how, where or what to start with.&lt;/p&gt;

&lt;p&gt;Before start the tutorial you will need to install MySQL Server on your machine along with MySQL Client for writing SQL.&lt;/p&gt;

&lt;p&gt;I'll write out the steps for Ubuntu Users, if your not using Ubuntu you will need to google the setup steps.&lt;/p&gt;

&lt;p&gt;First off: Update your OS.&lt;br&gt;
No start of a project is complete without an apt update :)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This ensures your repo's are all up to date.&lt;/p&gt;

&lt;p&gt;Install MySQL&lt;br&gt;
On Ubuntu this is dead easy, no crazy warren of pages to find the right download.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install mysql-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Accept any of the prompts about disk space and continue.&lt;/p&gt;

&lt;p&gt;Next you need to run the secure installer.&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;Type y for all of the questions you get until it asks what level of security you want, then type 0 for the lowest settings of security.&lt;/p&gt;

&lt;p&gt;Note: This really doesn't matter as its a local test DB, if it was live we would need to use more secure passwords.&lt;/p&gt;

&lt;p&gt;And thats it.... MySQL is installed.&lt;/p&gt;

&lt;p&gt;Now onto the MySQL Client&lt;/p&gt;

&lt;p&gt;Install Dbeaver CE&lt;br&gt;
DbeaverCE is a free open source Database management tool. I used to use a tool called DB Visualiser but this was a premium tool (over £100) and to be honest didn't give enough of a benefit over a free version so now i use either Jetbrains DataGrip or Dbeaver.&lt;/p&gt;

&lt;p&gt;to install simple type the following in your terminal.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo snap install dbeaver-ce
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Done! Its now installed and you can open it from the applications menu!&lt;/p&gt;

&lt;p&gt;Now onto Sample Database.&lt;/p&gt;

&lt;p&gt;Employee Database installation&lt;br&gt;
MySQL link to a few Example DB's but i quite like the Employee one for getting started with.&lt;/p&gt;

&lt;p&gt;To install simply open up a terminal and cd to a location you're happy with like Documents. When there type the following into the terminal:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/datacharmer/test_db.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now cd into this directory...&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;Once in this directory type the following in the terminal:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mysql &amp;lt; employees.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You should then see the below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FCgS8caYZGXNm7YiPQncJ3MF6llWcGKIXf8f7x12c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraspada-blog.co.uk%2Fstorage%2Fwink%2Fimages%2FCgS8caYZGXNm7YiPQncJ3MF6llWcGKIXf8f7x12c.png" alt="SQL Import screenshot" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
In this post we have looked at VERY basic database requests, next post we shall bring in another table and also SELECT aliasing.&lt;/p&gt;

&lt;p&gt;If you found this post useful please consider following me on twitter &lt;a class="mentioned-user" href="https://dev.to/skino2020"&gt;@skino2020&lt;/a&gt; for future updates to this series and if you found it really helpful consider buying me a coffee here.&lt;/p&gt;

</description>
      <category>mysql</category>
      <category>dbeaver</category>
      <category>coding</category>
    </item>
    <item>
      <title>Tart up your terminal!</title>
      <dc:creator>skino</dc:creator>
      <pubDate>Thu, 26 Aug 2021 22:51:25 +0000</pubDate>
      <link>https://forem.com/skino2020/tart-up-your-terminal-16n7</link>
      <guid>https://forem.com/skino2020/tart-up-your-terminal-16n7</guid>
      <description>&lt;p&gt;In the last few blog entries i have about Ubuntu a lot. from building a dev environment from scratch all the way through to how it feels still using it a week on. As i'm getting more and more familiar with Linux again after so many years away from it i want to make my terminal look a little better :)&lt;/p&gt;

&lt;p&gt;Now there is a lot of people who will say this is a waste of time and blah blah blah but its something i like doing, with the PHP and Laravel stuff i do i have a terminal window open pretty much all the time (so i don't need to open the IDE one) so making my terminal look nicer is just a personal preference.&lt;/p&gt;

&lt;p&gt;Check out the full post: &lt;a href="https://raspada-blog.co.uk/blog/tart-up-that-terminal" rel="noopener noreferrer"&gt;Tart up that terminal&lt;/a&gt;&lt;/p&gt;

</description>
      <category>terminal</category>
      <category>linux</category>
      <category>macos</category>
    </item>
  </channel>
</rss>
