I changed my folder structure and namespaces in my project. Previously I used the following namespace in my controllers:
App\Http\Controllers\FrontEnd\
I changed my folder structure and changed all my namespaces to
App\Http\FrontEnd\Controllers\
I run:
composer self-update
Then I run:
composer dump-autoload -o
Finally I run:
composer update
Everything updated successfully then at the end of it all I get this error:
[ReflectionException]
Class App\Http\Controllers\FrontEnd\Auth\AuthController does not exist
The only think I can think of is that I forgot to change something somewhere important.
You need to look in your project file usages of AuthController. You said that you change folder structure to App\Http\FrontEnd\Controllers\ and as you see for AuthController you get error App\Http\Controllers\FrontEnd\Auth\AuthController so probably somewhere in your code you have: Auth\AuthController:...
Related
When I try to make a migration using
PHP artisan make: migration create_packages_table
I get this error. What does this mean?:
Ciao, as this guide said:
What you’re missing is running composer install, which will import your packages.
Try to do:
composer install
Or
composer update
I think you need to check your file permissions, in that case specifically in your database directory. From the laravel root directory do this:
cd database
ls -l
make sure you see the migrations directory and that it's writable for your current user.
We get random errors in php (windows 7 with xampp):
PHP Fatal error: Class [NAME OF MY CLASS] not found
The class exists and the HTTP requests for the same call works 99% of the time, but sometimes we get this error. Why?
UPDATE:
I already run composer dump-autoload and the mapping is in the autoload_psr4.php file.
BUT, I found there's also a mapping that starts with the same path, but with an invalid folder, for example:
My class is: Path/SubPath/ClassX
In autoload_psr4.php i have (in this same order):
'Path\\SubPath\\' => array($vendorDir . '/company/project/src'),
'Path\\' => array($baseDir . '/src'),
The problem here is: in the second entry, the $baseDir . /src folder doesn't exists. Can this explain why I get random errors? (By sometimes getting the second mapping instead of the first one)
i think you need to run : composer dump-autoload.
composer dump-autoload regenerates the
list of all classes that need to be included in the project
(autoload_classmap.php). Ideal for when you have a new class inside
your project
Then run the following three commands:
php artisan clear-compiled
composer dump-autoload
php artisan optimize
This will clear the current compiled files, update the classes it needs and then write them back out so you don't have to do it again.
This is a laravel specific issue. Try this commands:
composer dump-autoload -o
php artisan clear-compiled
php artisan optimize
I have built some migration classes in my application to create the tables I need, but I keep getting errors. I need to run this command:
composer dump-autoload
Only then it works again as expected. Am I doing something wrong that generates this error or this is a normal behaviour with migrations?
Below is the error that I get when running the migration process:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'CreateVideoStatusTable' not found
OK so I think i know the issue you're having.
Basically, because Composer can't see the migration files you are creating, you are having to run the dump-autoload command which won't download anything new, but looks for all of the classes it needs to include again. It just regenerates the list of all classes that need to be included in the project (autoload_classmap.php), and this is why your migration is working after you run that command.
How to fix it (possibly)
You need to add some extra information to your composer.json file.
"autoload": {
"classmap": [
"PATH TO YOUR MIGRATIONS FOLDER"
],
}
You need to add the path to your migrations folder to the classmap array. Then run the following three commands...
php artisan clear-compiled
composer dump-autoload
php artisan optimize
This will clear the current compiled files, update the classes it needs and then write them back out so you don't have to do it again.
Ideally, you execute composer dump-autoload -o , for a faster load of your webpages. The only reason it is not default, is because it takes a bit longer to generate (but is only slightly noticable).
Hope you can manage to get this sorted, as its very annoying indeed :(
You should run:
composer dump-autoload
and if does not work you should re-install composer
Short answer: classmaps are static while PSR autoloading is dynamic.
If you don't want to use classmaps, use PSR autoloading instead.
My error was placing a function inside config/fortify.php, in my case it was an anonymous function that gave the error.
The definitive solution for this is to see what files I normally modify in the config/ folder.
In many places they say delete the files from bootstrap/cache/* but it didn't work in my case, and it didn't really make sense. In any case I leave you the commands:
php artisan clear-compiled
composer dump-autoload
php artisan optimize
But I really recommend that you go through the base laravel config files that you have configured. here you will find the error.
So, I installed Laravel on a dev server (php5.5.3, standard installation, mcrypt installed), and I get the following error message:
Fatal error: Class 'Illuminate\Foundation\Application' not found in /[path_to_laravel_app]/bootstrap/start.php on line 14
Quite odd, and I haven't seen a solution to this file, although I've seen plenty of similar errors. Any advice welcome. Thanks!
/bootstrap/start.php is created after composer install by running Laravel's php artisan optimize. I've had a lot of issues on this during upgrades of Laravel, but removing /bootstrap/start.php, composer.lock, and the vendor directory and re-running composer install should fix this issue.
Run this command:
composer update --no-scripts
In my case I have added another required package(Guzzle) in the compser.json file separately(in the last line but it should be after the laravel package line) and updated the compsoser and came across this issue.
I have checked and my vendor/laravel folder has gone. That was preventing me to run any artisian command.
So "--no-scripts" worked for me as it prevents any scripts to be included before executing artisan.
You can use another method in case you are having issues.
Install another raw laravel and copy all the files from the vendor
file to your old repostory.
Change permission of storage and bootstrap folder to 775 or 777.
Delete everything in the session and view folder of storage/framework
Correct the composer.json. This might happen after you have added a new package configuration by dublicating the require tag.
Do not create yet another
require: {
..
}
use the previous defined one.
Then follow the accepted answer to re-install the packages.
Just Run the command
composer install --no-scripts
Or,
composer update --no-scripts
Double check your composer.json file. If you have error on "require": section this error will occur.
Just restore a previous version of composer.json file and run composer update.
I am a symfony noob and I installed FOSUserBundle in the src/ directory of my project and everything was working fine. I wanted to move the bundle to the vendor folder to keep everything tidy but now I am getting the following error below:
ERROR:
Fatal error: Class 'FOS\UserBundle\FOSUserBundle' not found in app\AppKernel.php on line 22
Is there a file I have to update to make symfony look in the vendor folder?
You don't just move files into the vendor directory. The vendor directory is managed by Composer. The way that you add something to your vendor directory is to open the composer.json file, and add a line under "requirements" that looks something like this:
"friendsofsymfony/user-bundle": "dev-master"
The name on the left comes from the package repository at packagist.org, but the better way to find a little more about how to do this is in their documentation
That should contain everything you need to install it correctly.
Once you get it added, and run php composer.phar update from your application directory, Composer will download FOSUserBundle, place it in the vendor directory, and add it to the autoloader's namespace and classmaps.