I've read other issues about "ReflectionException Class ClassName does not exist" which refers to database seeders. I tried solutions from these questions and they didn't solve problem.
I've run into problem when tried to create model with command
php artisan make:model Country
(I've already had countries table)
after that I constantly get error
vagrant#homestead:~/Code/l53$ php artisan
[ReflectionException]
Class Country does not exist
What I did after that:
created Country model manually
http://joxi.ru/YmEyoL7CVNL0m6
added path to classmap
http://joxi.ru/J2b4QvLc1dMgr6
run:
composer update --no-scripts
composer dump-autoload -o
sudo composer self-update
deleted bootstrap/cache/services.php (there was only this file)
After every of these steps after running 'php artisan' I still receive:
[ReflectionException]
Class Country does not exist
and after running composer update I receive:
vagrant#homestead:~/Code/l53$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
Illuminate\Foundation\ComposerScripts::postUpdate
php artisan optimize
[ReflectionException]
Class Country does not exist
Script php artisan optimize handling the post-update-cmd event returned with error code 1
Any help is appreciated. Thanks in advance.
P.S. I use laravel 5.3 via homestead
I tried to remove vendor folder and 'composer update' (which recreated it) which didn't help.
but after 'vagrant reload' it (php artisan) worked... strange issue)
Related
I've been trying to work on a laravel app but I can't even make it start.
I've run composer install, composer global update, composer udpate, composer self-update and several other commands,
I've deleted the vendor folder, the composer.lock file, re-ran composer install and things I've found online to no avail. This is the error I keep getting:
#php artisan package:discover
In Container.php line 779:
Class request does not exist
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 1
Not sure where to go next. Any ideas?
I would suggest you remove your composer itself and re-install the composer. the try install you laravel packages with it.
Try clearing application cache using this command: php artisan cache:clear
The cache:clear command can be used to clear the applications cache files.
Don't worry about your laravel
check composer correctly installed on your system
check composer have access for READ and WRITE in your system
after your sure about things
check your laravel install in your system for PHP you have and find specific you php version composer connected to it (Those who have multi PHP)
then have two option:
composer global require laravel/installer
then laravel new blog or
composer create-project --prefer-dist laravel/laravel blog
then go to folder cd /projectName
Use PHP's built-in development server: php artisan serve
I had installed PragmaRx\Tracker package several months ago into my project.
I started to deleting the package from laravel project through following steps:
1. composer remove vendor/PragmaRx/Tracker
2. remove package name form composer.json file
3. removing package from provider and aliases list in config/app.php file
4. composer dump-autoload
5. composer update
6. also php artisan dump-autoload
I also tried a bunch of other ways to remove the package.
after removing the package I'm getting this error when I run any artisan command (even "php artisan serve" command):
In ProviderRepository.php line 208:
Class 'PragmaRX\Tracker\Vendor\Laravel\ServiceProvider' not found
It's obvious that the package and its related files have been removed! but I couldn't find out the error's reason.
my laravel version is 5.5.4 .
any idea?
finally I found the error's reason.It's because of laravel cache!!
in one hand I couldn't run any artisan command including "php artisan config:cache" to clear laravel cache, in the other hand the cache was the error's reason.So at first I re-installed the pachage :
composer require PragmaRx/Tracker
then :
php artisan config:cache
and finally :
composer remove PragmaRx/Tracker
Done.
Whenever I do composer update or artisan cache:clear and I get the following error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Fatal error: Class 'Aws\Laravel\AwsServiceProvider' not found
My app.php config file doesn't contain the AWS in the providers and or aliases. I've tried adding 'Aws\Laravel\AwsServiceProvider::class,' under providers and 'AWS => Aws\Laravel\AwsFacade::class,' under aliases but still the same issue. I think something is caching weird and doesn't recognize the updates I'm doing on app.php config file.
delete the files (not the directory) in bootstrap/cache
run composer dump-autoload
remove config/aws.php if it exists
run composer install
just do a : composer dump-autoload
and after that try to run you command like normal: composer update
i'm trying to install the anahkiasen/former package once again but it won't work. The funny thing is, I downloaded it about a weak ago and it was working perfectly. My code if finished and use's this former package. I tried to install a new package a half hour ago and since this the former class isn't found anymore.
Like I mentioned it, it was working perfectly before, but since I did a composer update it doesn't work.
Well I did what they said over here:
https://github.com/formers/former/wiki/Getting-started
first I run this::
composer require anahkiasen/former:4.0.*#dev
then a composer update
after the update I add this in my config/app.php provider section:
Former\FormerServiceProvider::class,
and this in the alias section:
'Former' => 'Former\Facades\Former',
I tried it but it still doesn't work. Just getting
Class 'Former\FormerServiceProvider' not found
as an output
I removed the package I wanted to install before and found another way.. But the problem with the former class is still there.
Thanks for any help!
Terminal outputs:
/var/www/laravel# php composer.phar require anahkiasen/former
gives:
Using version ^4.0 for anahkiasen/former
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
-------- then I added the provider/alias --- after this:
composer update --no-scripts
gives
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
composer dump-autoload
gives of course:
Generating autoload files
/var/www/laravel/logs# php artisan config:publish anahkiasen/former
gives:
PHP Fatal error: Class 'Former\FormerServiceProvider' not found in /var/www/laravel/logs/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Former\FormerServiceProvider' not found
note that I changed the directory in the last command
Let's start from the beginning.
Follow below steps:-
1) Run below command in terminal:-
composer.phar require anahkiasen/former
2) It'll ask you for the version, type dev-master
3) Add Former's service provider to your Laravel application in app/config/app.php. In the providers array add :
'Former\FormerServiceProvider',
Add then alias Former's main class by adding its facade to the aliases array in the same file :
'Former' => 'Former\Facades\Former',
4) run composer update --no-scripts
After that, run composer dump-autoload, and that should work.
If not working then run this command:-
php artisan config:publish anahkiasen/former
Hope it will help you :)
When I do:
php artisan migrate:refresh
I get this error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'CreatePasswordRemindersTable' not found
I have no migration for CreatePasswordRemindersTable in my project, I don't from where Laravel is trying to migrate this?
I tried to do composer dump-autoload, composer update but I am stuck at the same error
I tried to seach for CreatePasswordRemindersTable in my project folder file's content, but there isn't any result for it.
Any idea?
Check the migrations table in your database. You probably created a migration at some point and then you deleted the corresponding file.
Usually a composer dump-autoload fixes the "Class not found" problems.