バージョン確認
1 2 |
/var/www/html # php artisan -V Laravel Framework 10.3.3 |
Laravel Breezeを利用するためにはcomposerコマンドを利用してパッケージのインストールを行う必要があります。
1 |
$ composer require laravel/breeze --dev |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
Info from https://repo.packagist.org: #StandWithUkraine ./composer.json has been updated Running composer update laravel/breeze Loading composer repositories with package information Updating dependencies Lock file operations: 1 install, 0 updates, 0 removals - Locking laravel/breeze (v1.19.2) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 1 install, 0 updates, 0 removals - Downloading laravel/breeze (v1.19.2) - Installing laravel/breeze (v1.19.2): Extracting archive Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi INFO Discovering packages. laravel/breeze ......................................................................................................................... DONE laravel/sail ........................................................................................................................... DONE laravel/sanctum ........................................................................................................................ DONE laravel/tinker ......................................................................................................................... DONE nesbot/carbon .......................................................................................................................... DONE nunomaduro/collision ................................................................................................................... DONE nunomaduro/termwind .................................................................................................................... DONE spatie/laravel-ignition ................................................................................................................ DONE 80 packages you are using are looking for funding. Use the `composer fund` command to find out more! > @php artisan vendor:publish --tag=laravel-assets --ansi --force INFO No publishable resources for tag [laravel-assets]. No security vulnerability advisories found Using version ^1.19 for laravel/breeze |
パッケージのインストール後にbreezeのインストールを行います。インストール時にデフォルト(Alpine.js)、Inertia.js + Vue.js, Inertia.js + Reactのどれを利用するのかオプションで指定することができます。Reactを利用する場合はreactを指定します。
※実行すると既存ファイルが変更されます。
1 |
$ php artisan breeze:install react |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
./composer.json has been updated Running composer update inertiajs/inertia-laravel laravel/sanctum tightenco/ziggy Loading composer repositories with package information Updating dependencies Lock file operations: 2 installs, 0 updates, 0 removals - Locking inertiajs/inertia-laravel (v0.6.9) - Locking tightenco/ziggy (v1.5.0) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 2 installs, 0 updates, 0 removals - Downloading inertiajs/inertia-laravel (v0.6.9) - Downloading tightenco/ziggy (v1.5.0) 0/2 [>---------------------------] 0% 2/2 [============================] 100% - Installing inertiajs/inertia-laravel (v0.6.9): Extracting archive - Installing tightenco/ziggy (v1.5.0): Extracting archive 0/2 [>---------------------------] 0% 1/2 [==============>-------------] 50% 2/2 [============================] 100% 1 package suggestions were added by new dependencies, use `composer suggest` to see details. Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi INFO Discovering packages. inertiajs/inertia-laravel ............................................. DONE laravel/breeze ........................................................ DONE laravel/sail .......................................................... DONE laravel/sanctum ....................................................... DONE laravel/tinker ........................................................ DONE nesbot/carbon ......................................................... DONE nunomaduro/collision .................................................. DONE nunomaduro/termwind ................................................... DONE spatie/laravel-ignition ............................................... DONE tightenco/ziggy ....................................................... DONE 81 packages you are using are looking for funding. Use the `composer fund` command to find out more! > @php artisan vendor:publish --tag=laravel-assets --ansi --force INFO No publishable resources for tag [laravel-assets]. No security vulnerability advisories found INFO Installing and building Node dependencies. added 70 packages, and audited 169 packages in 9s 27 packages are looking for funding run `npm fund` for details found 0 vulnerabilities > build > vite build vite v4.1.4 building for production... ✓ 211 modules transformed. public/build/manifest.json 6.75 kB public/build/assets/app-e1fa11f2.css 29.42 kB │ gzip: 5.77 kB public/build/assets/InputLabel-e0dade4f.js 0.20 kB │ gzip: 0.18 kB public/build/assets/GuestLayout-0d129d9e.js 0.49 kB │ gzip: 0.32 kB public/build/assets/PrimaryButton-8ecb3e3d.js 0.50 kB │ gzip: 0.33 kB public/build/assets/TextInput-11c6e34f.js 0.53 kB │ gzip: 0.36 kB public/build/assets/Dashboard-aa637198.js 0.64 kB │ gzip: 0.38 kB public/build/assets/Edit-c58f8d34.js 1.10 kB │ gzip: 0.51 kB public/build/assets/ForgotPassword-fc12426d.js 1.12 kB │ gzip: 0.64 kB public/build/assets/ConfirmPassword-a424104d.js 1.16 kB │ gzip: 0.64 kB public/build/assets/VerifyEmail-4396cb1c.js 1.22 kB │ gzip: 0.68 kB public/build/assets/ResetPassword-8c602d3d.js 1.65 kB │ gzip: 0.69 kB public/build/assets/Login-74f67e6f.js 2.02 kB │ gzip: 0.94 kB public/build/assets/Register-ce53cc58.js 2.17 kB │ gzip: 0.84 kB public/build/assets/UpdateProfileInformationForm-143ee1e4.js 2.17 kB │ gzip: 0.98 kB public/build/assets/UpdatePasswordForm-813bc3b8.js 2.22 kB │ gzip: 0.85 kB public/build/assets/ApplicationLogo-02680588.js 3.11 kB │ gzip: 1.32 kB public/build/assets/AuthenticatedLayout-dc1874db.js 5.61 kB │ gzip: 1.86 kB public/build/assets/transition-341c7bac.js 13.01 kB │ gzip: 5.09 kB public/build/assets/Welcome-c85d2167.js 15.59 kB │ gzip: 4.42 kB public/build/assets/DeleteUserForm-06bc8485.js 25.51 kB │ gzip: 9.29 kB public/build/assets/app-6b48bdc6.js 247.47 kB │ gzip: 82.04 kB INFO Breeze scaffolding installed successfully. |
トップページにアクセスし、下記の画面のように、右上に 「Log in」「Register」リンクが表示されていれば、正常に Breeze のインストールが完了しています。
routeの確認
認証関連のlogin、logoutなどのルートが追加されています。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
/var/www/html # php artisan route:list GET|HEAD / ................................................................................................................................. POST _ignition/execute-solution .......................... ignition.executeSolution › Spatie\LaravelIgnition › ExecuteSolutionController GET|HEAD _ignition/health-check ...................................... ignition.healthCheck › Spatie\LaravelIgnition › HealthCheckController POST _ignition/update-config ................................... ignition.updateConfig › Spatie\LaravelIgnition › UpdateConfigController GET|HEAD api/user .......................................................................................................................... GET|HEAD confirm-password ....................................................... password.confirm › Auth\ConfirmablePasswordController@show POST confirm-password ......................................................................... Auth\ConfirmablePasswordController@store GET|HEAD dashboard ............................................................................................................... dashboard POST email/verification-notification ............................ verification.send › Auth\EmailVerificationNotificationController@store GET|HEAD forgot-password ........................................................ password.request › Auth\PasswordResetLinkController@create POST forgot-password ........................................................... password.email › Auth\PasswordResetLinkController@store GET|HEAD login .......................................................................... login › Auth\AuthenticatedSessionController@create POST login ................................................................................... Auth\AuthenticatedSessionController@store POST logout ....................................................................... logout › Auth\AuthenticatedSessionController@destroy PUT password ......................................................................... password.update › Auth\PasswordController@update GET|HEAD profile ..................................................................................... profile.edit › ProfileController@edit PATCH profile ................................................................................. profile.update › ProfileController@update DELETE profile ............................................................................... profile.destroy › ProfileController@destroy GET|HEAD register .......................................................................... register › Auth\RegisteredUserController@create POST register ...................................................................................... Auth\RegisteredUserController@store POST reset-password .................................................................. password.store › Auth\NewPasswordController@store GET|HEAD reset-password/{token} ......................................................... password.reset › Auth\NewPasswordController@create GET|HEAD sanctum/csrf-cookie ............................................. sanctum.csrf-cookie › Laravel\Sanctum › CsrfCookieController@show GET|HEAD verify-email ......................................................... verification.notice › Auth\EmailVerificationPromptController GET|HEAD verify-email/{id}/{hash} ......................................................... verification.verify › Auth\VerifyEmailController |
参考サイト
Laravel9のLaravel Breeze+Reactでマルチ認証(Multi Authentification)
https://reffect.co.jp/laravel/laravel9-laravel-breeze#InertiaReact