This repository contains a template for a brand new Laravel 10 application.
yarn install
This repository template includes the use of Laravel Nova which is a paid application. Before getting started, you must either add an auth.json
to the root of this repository with valid credentials or remove Laravel Nova from the list of composer dependencies.
composer install
cp .env.example .env
php artisan key:generate
With your application now properly configured, you will need to create a new MySQL database. This template assumes the use of a database named laravel_inertia_vue_template
.
php artisan migrate:fresh --seed
yarn dev
If using Laravel Herd or Laravel Valet, your site should now be live: http://laravel-inertia-react-template.test.
In addition to Laravel, this application makes use of the following technologies.
I typically add the following packages to any Laravel application.
We additionally lean into the following configurations & plugins for these tools.
- eslint-config-prettier
- eslint-plugin-prettier
- eslint-plugin-tailwindcss
- eslint-plugin-vue
- prettier-plugin-tailwindcss
- vite-plugin-eslint
- vite-plugin-vue
- Set the default Redis client to
predis
. This change is not necessary if you enabled thephpredis
PHP extension.
- Replaced
$table->timestamps()
with thedate_created
andlast_updated
column names
- Replaced the
fillable
array with aguarded
array containingid
,date_created
, andlast_updated
- Split
name
intofirst
andlast
name fields withinApp\Models\User.php
- Added a
name
accessor that concatenatesfirst
andlast
fields - Removed PHPDoc blocks
- Enabled "strict mode" for Models by executing
Model::shouldBeStrict()
in theboot()
method ofProviders/AppServiceProvider.php
- Added the
LazilyRefreshDatabase
trait totests/TestCase.php
- Added a
login()
method totests/Pest.php
to easily create & authenticate users within tests
Are you starting from scratch? Want to see the commands that got us here?
# Install a new Laravel application with Pest PHP within a Git repository
laravel new laravel-inertia-vue-template --git --pest
# Install Inertia.js - Server-side
composer require inertiajs/inertia-laravel
# Set up the Inertia middleware
php artisan inertia:middleware
# Install Vue.js
yarn add -D vue
# Install Inertia.js - Client-side
yarn add -D @inertiajs/vue3
# Install Laravel Nova
composer config repositories.nova '{"type": "composer", "url": "https://nova.laravel.com"}' --file composer.json
# Manually add the following to your composer.json:
# "laravel/nova": "~4.0"
# Ensure you have a valid auth.json configured for installation before issuing a "composer update."
composer update --prefer-dist
# Install first-party composer packages
composer require laravel/horizon
composer require laravel/telescope
# Install third-party composer packages
composer require spatie/laravel-backup
composer require spatie/laravel-data
composer require spatie/laravel-ray
composer require spatie/laravel-view-models
composer require predis/predis
composer require pestphp/pest-plugin-faker --dev
composer require pestphp/pest-plugin-laravel --dev
composer require nunomaduro/larastan:^2.0 --dev
# Install & initialize Tailwind CSS
yarn add -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
# Install Tailwind CSS plugins
yarn add -D @tailwindcss/aspect-ratio
yarn add -D @tailwindcss/forms
yarn add -D @tailwindcss/typography
# Install ESLint & plugins
yarn add -D eslint
yarn add -D eslint-config-prettier
yarn add -D eslint-plugin-prettier
yarn add -D eslint-plugin-tailwindcss
yarn add -D eslint-plugin-vue
# Install Prettier & plugins
yarn add -D prettier
yarn add -D prettier-plugin-tailwindcss
# Install Stylelint
yarn add -D stylelint
yarn add -D stylelint-config-standard
# Install Vite plugins
yarn add -D @vitejs/plugin-vue
yarn add -D vite-plugin-eslint
# Install Laravel Horizon
php artisan horizon:install
# Install Laravel Telescope
php artisan telescope:install
# Install Laravel Nova
php artisan nova:install
# Migrate the database
php artisan migrate