jekinney's avatar

Laravel 11 Service Providers

I ran into an issue and wanted to show how I was able to resolve it until more of the documentation is updated.

Wanted to try out Laravel 11 and so started a new project. Also called in Jetstream with Inertia. BAM errors for not having a proper class bound while registering a user. Googling shows we need to add a provider to the app.php which that "providers" array doesn't exist. Not sure why it updates the array with JetStream class but not the Fortify class.

New location is /bootstrap/providers.php:

It was

<?php

return [
    App\Providers\AppServiceProvider::class,
    App\Providers\JetstreamServiceProvider::class,
];

And should be

<?php

return [
    App\Providers\AppServiceProvider::class,
    App\Providers\JetstreamServiceProvider::class,
    App\Providers\FortifyServiceProvider::class,
];
0 likes
6 replies
jlrdw's avatar

Sounds like an issue needs to be created. Thanks for the information. And where have you been?

jekinney's avatar

@jlrdw Hello again my friend. LOL, remember the times we answered 90% of the questions here!

I fell down the consultant rabbit hole so I spent time learning Yii, C#, CodeIgniter, and just enough Java to remember why I love PHP. All basically re-writing from some language and Framework to Laravel and usually Vue sometimes react. (long story longer) As such at times I bit off more than I could chew as far as getting burned out after work and NOT coding. Lot more video games, traveling and working on old cars instead.

Been a lot slower as projects finally wrapping up and I quit consulting for now. Now just a simple Senior Dev in the background.... (LOL).

I have been using your answers over the years too! So much appreciated and hope all is well with you, yours and everyone here. Still a great community overall seems like!!!

jlrdw's avatar

@jekinney I did some yii 2 apps also, but as of now no more yii for me, yii 3 kind of did it for me, did not like it at all.

I miss the earlier days of the forum.

My java days was back during J2EE 1.4, been a while now. And yes I admit I cheated and did some scriptlets, now frowned upon.

1 like
Snapey's avatar

Installing fresh Laravel project with Jetstream and Inertia. Laravel 11.0.6

Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 7 installs, 0 updates, 0 removals
  - Downloading mobiledetect/mobiledetectlib (4.8.06)
  - Downloading laravel/fortify (v1.21.0)
  - Downloading laravel/jetstream (v5.0.0)
  - Installing dasprid/enum (1.0.5): Extracting archive
  - Installing bacon/bacon-qr-code (2.0.8): Extracting archive
  - Installing mobiledetect/mobiledetectlib (4.8.06): Extracting archive
  - Installing paragonie/constant_time_encoding (v2.6.3): Extracting archive
  - Installing pragmarx/google2fa (v8.0.1): Extracting archive
  - Installing laravel/fortify (v1.21.0): Extracting archive
  - Installing laravel/jetstream (v5.0.0): Extracting archive
Generating optimized autoload files

Fortify installed.

app\bootstrap/providers.php

<?php

return [
    App\Providers\AppServiceProvider::class,
    App\Providers\FortifyServiceProvider::class,
    App\Providers\JetstreamServiceProvider::class,
];

However, install Laravel 11 and then composer require Jetstream and the bootstrap file is not changed until you run php artisan jetstream:install

Could you have missed that step?

2 likes
jekinney's avatar

@Snapey Thank you as always. Installed a fresh app and this time good to go. BUT to answer your question, if I hadn't used the instal command I would have only have the AppServiceProvider as verified before I ran composer install.

To be fair I am running W11 and using Sail (QSL2 with Ubuntu) which permissions wise is a nightmare depending how your trying to access directories. IE: Using the ubuntu terminal not windows explorer etc.

1 like
jekinney's avatar

Still a minor issue on windows 11 using sail on new installs. Takes .2 seconds to add the missing class.

Please or to participate in this conversation.