Jun 28, 2020

Quick setup Laravel (with Tailwind scaffold)

I won't update this article. It might be outdated.

I often install a fresh Laravel app to test a new package or replicate the setup for a tutorial. This is the fastest way to get a vanilla Laravel with Auth and Tailwind. The first step is only required if you have not installed the Laravel installer before ($ means that you have to enter that to your terminal):

  • ($ composer global require laravel/installer)
  • $ laravel new project
  • $ cd project && code . (opens in VSCode)
  • Open .env
  • Change DB_CONNECTION=mysql to DB_CONNECTION=sqlite
  • Remove all lines not needed for SQLite: DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME and DB_PASSWORD
  • $ touch database/database.sqlite to create the SQLite database
  • $ composer require laravel-frontend-presets/tailwindcss --dev
  • $ php artisan ui tailwindcss --auth to scaffold Tailwind frontend
  • $ npm install && npm run dev to install the frontend
  • $ php artisan migrate to migrate the database
  • $ valet open or $ php artisan serve to open the site

Source: https://twitter.com/Martin_Betz/status/1256610649716723716

P.S. If you want to automate the installation and add Git and some more, you might find Tighten Co's Lambo useful.

Categories: Tech