{"id":5794,"date":"2025-09-01T03:40:35","date_gmt":"2025-09-01T03:40:35","guid":{"rendered":"https:\/\/www.voodoo.business\/blog\/?p=5794"},"modified":"2025-09-15T05:43:58","modified_gmt":"2025-09-15T05:43:58","slug":"installing-laravel-12-with-social-login","status":"publish","type":"post","link":"https:\/\/www.voodoo.business\/blog\/2025\/09\/01\/installing-laravel-12-with-social-login\/","title":{"rendered":"installing Laravel 12 with social login"},"content":{"rendered":"\n<p>Normally this would not have been worthy of a blog post of its own, there are plenty of posts that explain how to do this, but because I don&#8217;t want the post on &#8220;<a href=\"\/blog\/2025\/08\/30\/gradually-migrating-a-legacy-system-to-laravel\/\">Gradually migrating to laravel<\/a>&#8221; to be too long, I have decided to move the part on how to setup a vanilla install of laravel to its own post.<\/p>\n\n\n\n<p>Rather than having you setup sociallite in laravel, there is an amazing starter kit on github (<a href=\"https:\/\/github.com\/Laravel-Uis\/socialite-ui\">https:\/\/github.com\/Laravel-Uis\/socialite-ui<\/a>) that we will be using to hit the ground running, this is not an official starter kit, it is by a third party, namely Joel Butcher, the same person behind the good old, now unmaintained socialstream (Socialite and JetStream)<\/p>\n\n\n\n<p>So, let&#8217;s get down to business, I assume you have a debian machine up and running<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt install php-fpm nginx libnginx-mod-http-headers-more-filter openssl<br>apt install php-{dev,common,xml,tokenizer,zip,mysql,curl,mbstring,mysql,opcache,gd,intl,json,xsl,bcmath,imap,soap,readline,sqlite3,gmp,guzzlehttp-guzzle}<\/pre>\n\n\n\n<p>Now, make sure the following PHP extensions are enabled (i am pretty sure they are after the commands above) but to be safe, check in php.ini<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">extension=fileinfo<br>extension=mbstring<br>extension=openssl<\/pre>\n\n\n\n<p>Remember to &#8220;mariadb-secure-installation&#8221;, then create a username and database in mysql for laravel ! you can either use PHPMYADMIN or from the command line, makes no difference, remember to flush privileges<\/p>\n\n\n\n<p>Install composer and nodejs<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt install composer nodejs npm<br>composer --version<\/pre>\n\n\n\n<p>Now, I am assuming your web directory is owned by the web server user ! first, install laravel globally, this is a new tool we will use to create laravel installations from now on<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">su - webdev (Whatever user you want to execute under)<br>composer global require laravel\/installer<\/pre>\n\n\n\n<p>Now, add laravel to your path in <em>.bashrc<\/em><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">export PATH=\"$HOME\/.config\/composer\/vendor\/bin:$PATH\"<br>source ~\/.bashrc<br>echo $PATH<\/pre>\n\n\n\n<p><strong>IMPORTANT<\/strong>: In my case, all my websites are in folders that follow the patern &#8220;\/var\/www\/vhosts\/com.websitename.www\/public&#8221;&#8230; hence, i execute the lines below from within the &#8220;\/var\/www\/vhosts\/&#8221; directory ! once i execute the below line, i will have a folder called my-app, I usually rename that to com.websitename.www and there is already a public folder in there, The long and short of this story is, your whole project folder with the public directory inside is creating from the command below, if you do it wrong, you can simply move the files and folders in that folder to where they should be<\/p>\n\n\n\n<p>And now, in your project directory (Which is one level below your public web directory), execute the following, the laravel command is the new way, and if you are not looking for Livewire Volt, just visit the github page to see your 3 other options (Vue, React, and Livewire without volt)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">laravel new my-app --using=laravel-uis\/socialite-ui-livewire-starter-kit<\/pre>\n\n\n\n<p>During the install, it will ask you what testing framework you want, You can pick whatever one you prefer, then it will ask you if you would like to run &#8220;npm install and npm run build?&#8221;, You can hit no, and run the following command yourself<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">npm install &amp;&amp; npm run build<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configure<\/h3>\n\n\n\n<p>Now, edit your .env ! the default one uses sqlite, if you want to use mysql \/ mariadb (like most PHP people), just make sure this becomes your database in your .env file<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">DB_CONNECTION=mysql<br>DB_HOST=127.0.0.1<br>DB_PORT=3306<br>DB_DATABASE=laravel<br>DB_USERNAME=root<br>DB_PASSWORD=<\/pre>\n\n\n\n<p>Now, run the following commands<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php artisan migrate<br><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">The following commands are for reference only<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">php artisan session:table<br>php artisan queue:table<br>php artisan cache:table<br>php artisan migrate<br>php artisan config:clear<br>php artisan route:clear<br>php artisan view:clear<br>php artisan cache:clear<br>php artisan migrate:status<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Behind Proxy<\/h3>\n\n\n\n<p>If you are behind a proxy, you might need to tell laravel 12 to trust proxies&#8230; (Edit <strong>\/bootstrap\/app.php<\/strong>), and add the parts<\/p>\n\n\n\n<p>first, add this line at the top<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">use Illuminate\\Http\\Request;<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">$middleware-&gt;trustProxies(<br>            \/\/at: '*',  \/\/ Trust all proxies (use for dynamic\/cloud setups like Nginx on the same server; see security notes below)<br>            at: ['127.0.0.1', '192.168.1.0\/24', 'xxx.xxx.xxx.xxx'],<br>            headers: Request::HEADER_X_FORWARDED_FOR |<br>                     Request::HEADER_X_FORWARDED_HOST |<br>                     Request::HEADER_X_FORWARDED_PORT |<br>                     Request::HEADER_X_FORWARDED_PROTO |<br>                     Request::HEADER_X_FORWARDED_AWS_ELB  \/\/ Include if using AWS; optional for standard Nginx<br>        );<\/pre>\n\n\n\n<p>Right where there is an empt comment inside <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">-&gt;withMiddleware(function (Middleware $middleware) {<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>Normally this would not have been worthy of a blog post of its own, there are plenty of posts that explain how to do this, but because I don&#8217;t want the post on &#8220;Gradually migrating to laravel&#8221; to be too long, I have decided to move the part on how to setup a vanilla install [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[124,123],"tags":[],"class_list":["post-5794","post","type-post","status-publish","format-standard","hentry","category-laravel","category-php"],"_links":{"self":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/5794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/comments?post=5794"}],"version-history":[{"count":33,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/5794\/revisions"}],"predecessor-version":[{"id":5947,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/5794\/revisions\/5947"}],"wp:attachment":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/media?parent=5794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/categories?post=5794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/tags?post=5794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}