<?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>DEV Community: Callum</title>
    <description>The latest articles on DEV Community by Callum (@duckduckdroid).</description>
    <link>https://dev.to/duckduckdroid</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%2F868325%2Fa92f8e47-ca29-4ee2-bff3-a57da25fbcdc.jpeg</url>
      <title>DEV Community: Callum</title>
      <link>https://dev.to/duckduckdroid</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/duckduckdroid"/>
    <language>en</language>
    <item>
      <title>Setting up PHP 8.2 + Laravel 11 dev environment on Multipass</title>
      <dc:creator>Callum</dc:creator>
      <pubDate>Mon, 22 Apr 2024 14:13:43 +0000</pubDate>
      <link>https://dev.to/duckduckdroid/php-laravel-multipass-8a5</link>
      <guid>https://dev.to/duckduckdroid/php-laravel-multipass-8a5</guid>
      <description>&lt;h2&gt;
  
  
  Setting up the dev box using Multipass on your machine
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install Multipass from &lt;a href="https://multipass.run"&gt;https://multipass.run&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;On Initial run of multipass it will setup the primary box, just let it and close it once it is done&lt;/li&gt;
&lt;li&gt;run &lt;code&gt;multipass launch -c 2 -d 10G -m 2G -name PHP8.2Laravel -v&lt;/code&gt; to setup ubuntu VM for dev

&lt;ol&gt;
&lt;li&gt;This will create a VM called &lt;code&gt;PHP8.2Laravel&lt;/code&gt;with 2GB’s of RAM and 2 CPU Cores as well as 10GB space&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;Next we need to open the box with  &lt;code&gt;multipass shell PHP8.2Laravel&lt;/code&gt; in your terminal&lt;/li&gt;
&lt;li&gt;Lets do a Quick update and upgrade on the Ubuntu OS in the box : &lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;add your SSH keys to &lt;code&gt;~/.ssh/authorized_keys&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;close the shell in windows PowerShell terminal run &lt;code&gt;multipass list&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;you should see something like this: &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;PHP8.2Laravel              Running           172.29.84.17     Ubuntu 22.04 LTS&lt;/code&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy the IP address (yours should be different to mine)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Getting VS Code to connect to PHP8.2Laravel VM
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open VS Code, install the extension “Remote - SSH”&lt;/li&gt;
&lt;li&gt;Once installed press &lt;code&gt;Ctrl + Shift + P&lt;/code&gt; and type &lt;code&gt;add ssh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;this should show you an option to Add new SSH host&lt;/li&gt;
&lt;li&gt;In the prompt you will add the following: &lt;code&gt;ssh ubuntu@[your IP address from above ]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Once the setup is complete, click connect in the bottom right hand corner

&lt;ol&gt;
&lt;li&gt;follow the prompts to say that you are sshing into a Linux machine etc…&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;🥳 You should now be in the PHP8.2Laravel VM with VS Code&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Installing &lt;code&gt;PHP(8.2)&lt;/code&gt; and &lt;code&gt;composer&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Please use the VS Code terminal from this step onwards.&lt;/p&gt;

&lt;p&gt;We need to add a PPA to install the latest version of PHP as of this post if is 8.3&lt;/p&gt;

&lt;p&gt;Install the tools needed to install a PPA:&lt;br&gt;
&lt;code&gt;sudo apt install software-properties-common ca-certificates lsb-release&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add the PPA (this is the Debian maintainers PPA so we can trust it)&lt;br&gt;
&lt;code&gt;LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej/php&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now let us install PHP, common libs, apache2 as well as &lt;code&gt;composer&lt;/code&gt; the PHP package manager &lt;code&gt;sudo apt-get install -y php8.2 php8.2-cli php8.2-common php8.2-mysql php8.2-sqlite3 php8.2-zip php8.2-gd php8.2-mbstring php8.2-curl php8.2-xml php8.2-bcmath composer&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After all of this we can run composer&lt;code&gt;-V&lt;/code&gt; and we should see the PHP version  as well as the Composer version, the PHP version should be &lt;code&gt;8.2.xx&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;If you open a browser and type the boxes IP address you should see an apache2 welcome screen 🥂&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up a Laravel(11) project
&lt;/h2&gt;

&lt;p&gt;This is the easy part simply run &lt;code&gt;composer create-project laravel/laravel [your-app-name]&lt;/code&gt;  &lt;/p&gt;

&lt;p&gt;Once that is done in the VS Code terminal type &lt;code&gt;code ./[your-app-name]&lt;/code&gt; and a new window should open with your project in it 👍&lt;/p&gt;

&lt;h2&gt;
  
  
  VS Code Magic
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install &lt;code&gt;PHP Extension Pack&lt;/code&gt; from VS Code extensions this will allow you to have intellisense over your codebase (it will take a few minutes after to index the project)&lt;/li&gt;
&lt;li&gt;To run your project type &lt;code&gt;php artisan serve&lt;/code&gt; into the VS Code terminal and you should see :  &lt;code&gt;INFO  Server running on [[http://127.0.0.1:8000](http://127.0.0.1:8000/)].&lt;/code&gt;

&lt;ol&gt;
&lt;li&gt;If you Ctrl Click on the &lt;a href="http://Localhost"&gt;Localhost&lt;/a&gt; IP address VS code will port forward :8000 to your local machine form the Ubuntu VM and open it in a web browser for you&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Happy hacking! 🥂
&lt;/h2&gt;

</description>
      <category>php</category>
      <category>webdev</category>
      <category>multipass</category>
      <category>laravel</category>
    </item>
  </channel>
</rss>
