SAHIB SHAKHAYEV
SAHIB SHAKHAYEV

Reputation: 1

Laravel Filament: "There are no commands defined in the 'filament' namespace"

I am using Laravel and trying to work with the Filament package. However, when I run any Filament-related Artisan commands (e.g., php artisan make:filament-resource), I get the following error:

ERROR  There are no commands defined in the "filament" namespace.

What I Have Tried: Installed Filament via Composer:

composer require filament/filament

The package installs without any errors.

Checked Filament Installation: Running composer show filament/filament confirms that the package is installed.

Cleared and Rebuilt Cache: I ran the following commands to ensure no cache issues:

php artisan cache:clear
php artisan config:clear
composer dump-autoload

Verified Service Provider: I checked the vendor/filament/filament/src/FilamentServiceProvider.php file, and it includes the getCommands() method that registers commands.

Tested Command Availability: I listed all Artisan commands with:

php artisan list | grep filament No filament namespace or commands appear.

Tried Publishing Configurations: Running php artisan vendor:publish --tag="filament-config" gives the message:




INFO  No publishable resources for tag [filament-config].

Laravel Compatibility: My Laravel version is compatible with the Filament package (Laravel version:11.34.2).

Checked Logs: The storage/logs/laravel.log file does not show any relevant errors.

Filament Service Provider: Here’s the FilamentServiceProvider code snippet from vendor/filament/filament/src/FilamentServiceProvider.php. It appears to be correctly set up to register commands.




protected function getCommands(): array
{
    return [
        Commands\MakeResourceCommand::class,
        Commands\MakePageCommand::class,
        // Other commands...
    ];
}

Additional Info: PHP version: 8.3.7 Laravel version: 11.34.2 Filament version: 3.2 Question: What could be causing this issue, and how can I ensure that the filament namespace commands are available in Artisan?

Upvotes: 0

Views: 290

Answers (1)

Johan
Johan

Reputation: 4859

From https://filamentphp.com/docs/3.x/panels/installation

composer require filament/filament:"^3.2" -W
php artisan filament:install --panels

Check that App\Providers\Filament\AdminPanelProvider::class is registered in bootstrap/providers.php

With Laravel sail it's

sail composer require filament/filament:"^3.2" -W
sail artisan filament:install --panels

Upvotes: 1

Related Questions