How to install Alpine.js with Laravel

npm install alpinejs

resources/js/app.js

import Alpine from "alpinejs";

window.Alpine = Alpine;

Alpine.start();
php artisan make:component layout

resources/views/components/layout.blade.php

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Laravel</title>

    @vite(['resources/css/app.css', 'resources/js/app.js'])
</head>

<body>
{{ $slot }}
</body>

</html>
npm run build

How to install Tailwind CSS with Laravel

npm install --save-dev tailwindcss postcss autoprefixer
npx tailwindcss init --postcss

tailwind.config.js

/** @type {import('tailwindcss').Config} */
export default {
  content: [
    "./resources/**/*.blade.php",
    "./resources/**/*.js",
    "./resources/**/*.vue",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

resources/css/app.css

@tailwind base;
@tailwind components;
@tailwind utilities;
php artisan make:component layout

resources/views/components/layout.blade.php

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Laravel</title>

    @vite(['resources/css/app.css', 'resources/js/app.js'])
</head>

<body>
{{ $slot }}
</body>

</html>
npm run build

How to install Filament

composer require filament/filament &&
php artisan filament:install --panels &&
php artisan make:filament-user --name=admin --email=admin@example.com --password=password

How to install Composer on Ubuntu

cd &&
curl -sS https://getcomposer.org/installer -o composer-setup.php &&
HASH=`curl -sS https://composer.github.io/installer.sig` &&
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" &&
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer &&
composer &&
unlink composer-setup.php

Laravel Service Container Automatic Injection

php artisan make:class Services/Calculator

app/Services/Calculator.php

<?php

namespace App\Services;

class Calculator
{
    public function add(array $numbers): int
    {
        return array_sum($numbers);
    }
}

routes/web.php

<?php

use App\Services\Calculator;
use Illuminate\Support\Facades\Route;

Route::get('/', function (Calculator $calculator) {
    return $calculator->add(range(1, 100));
});