Might be the section of the composer.json for "autoload".
By default Laravel is set to autoload the "App" namespace which you are renaming with this command. So the value "App\" needs to be "AppName\" I think. That's where I would start anyway.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am having a problem generating an application name in my project. When I generated php artisan app:name AppName, I encountered this error:
PHP Fatal error: Uncaught ReflectionException: Class AppName\Console\Kernel does not exist in /home/user/Desktop/AppName/vendor/laravel/framework/src/Illuminate/Container/Container.php:741
...
This is my composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"barryvdh/laravel-debugbar": "^2.2",
"parse/php-sdk" : "1.2.*",
"graham-campbell/parse": "^2.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
How can I fix this problem? Thanks in advance!
Please or to participate in this conversation.