Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Udev's avatar
Level 2

Can't install passport on laravel 11

I am following the docs on installing passport on Laravel 11 but it doesn't seem to work. I get "Undefined type 'Laravel\Passport\HasApiTokens' " and "There are no commands defined in the 'passport' namespace". Please help

0 likes
6 replies
martinbean's avatar

@udev If you’re getting those errors then you’ve not actually installed Passport.

Run composer require laravel/passport again, and check from the output the package is actually installed.

Udev's avatar
Level 2

@martinbean I installed passport using "php artisan install:api --passport" as per laravel 11 docs. running "composer require laravel/passport", I get "Your requirements could not be resolved to an installable set of packages."

martinbean's avatar
Level 80

I get "Your requirements could not be resolved to an installable set of packages."

@Udev Right, so Passport’s not actually getting installed then. Don’t just keep following steps if you get an error at one of them, because subsequent steps are unlikely to success if a previous one has failed, like you have found by trying to run Passport-related commands when Passport wasn’t installed properly.

So, read the error message properly instead of just ignoring it and carrying on. You‘re trying to install versions of packages that are incompatible with each other.

1 like
Udev's avatar
Level 2

@martinbean After going through the error, I realized I need to enable sodium & zip extensions in my php.ini file an it works now. The "php artisan install:api --passport" command didn't give me any error though.

5 likes

Please or to participate in this conversation.