Why its showing class not found errors? - php

I just cloned a git repo and ran the necessary commands to install the project.
When I access the login page "http://localhost:80/nova/login" it works. However after enter the correct credentials and submit it shows an error:
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Class '\App\User' not found
Do you know what can be the issue?
Also running this command:
/var/www # php artisan component:update
It shows a similar error:
Starting Update of All Component files
Symfony\Component\Debug\Exception\FatalThrowableError : Class 'App\Component' not found

After cloning, running through these steps should fix your problem:
run composer install or npm install.
check that the .env file is correct.
run php artisan key:generate
Optional: php artisan migrate
run php artisan serve

Reload composer autloaded classes.
composer dump-autoload

Related

Class 'Illuminate\Cache\CacheServiceProvider' not found

I'm working on a laravel project with my android phone.
I cleared junk files on the phone using a software and now I get error when trying to serve the laravel project.
First, I ran php artisan serve and got this error:
$ php artisan serve
In PackageManifest.php line 168:
The /storage/emulated/0/web/tbcians/bootstrap
/cache directory must be present and writable
.
Then I created the cache directory and ran php artisan serve again and got another error:
$ php artisan serve
In ProviderRepository.php line 208:
Class 'Illuminate\Cache\CacheServiceProvider'
not found
How do I fix this?
I've tried running
$ composer update
and
$ composer update --no-scripts
but I'm still getting the error
This solved the problem:
Remove "vendor" directory. Use "rm -rf vendor" if you in terminal
Remove composer.local file from root
Run "composer install"
– Jickson Johnson Koottala
First clear your cache.php artisan cache:clear. Then composer update

Laravel composer install error BroadcastServiceProvider Class not found

composer install --no-interaction --no-dev --prefer-dist
I try to deploy my app on DigitalOcean server, got error when executing above command.
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Illuminate\Broadcasting\BroadcastServiceProvider' not found
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
Other details listed below:

Class 'Jenssegers\Mongodb\MongodbServiceProvider' not found

I want to use https://github.com/jenssegers/laravel-mongodb for connecting to Mongodb with laravel 5, i have installed MongoDB php driver and then laravel-mongodb with command composer require jenssegers/mongodb, then added service provider in app/config/app.php:
'Jenssegers\Mongodb\MongodbServiceProvider',
and refreshed my website, unfortunately i got error ->
FatalErrorException in compiled.php line 6466:
Class 'Jenssegers\Mongodb\MongodbServiceProvider' not found
how can i fix it?
run composer dump-autoload or php artisan optimize
I didn't have the archive:
myproject/vendor/jenssegers.
I installed this archive by command:
$ composer require jenssegers/mongodb
Delete Following Files and Use This Step :
composer.lock
bootstrap/cache/config.php
if exist
bootstrap/cache/services.php
then Run this command :
composer install
php artisan config:cache
If the previously mentioned solutions won't do the trick, it is possible that some dependencies are missing. Simply try:
$ composer install

Laravel5 can't use package

I'm using L5(dev version) and trying to create package.
Doing `php artisan workbench za-web/Sidebar --resources
It's creating for me structure and service provider.
And then I'm trying to add service provider to app/config.php
'ZaWeb\Sidebar\SidebarServiceProvider'
I've got the error:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR)
Class 'ZaWeb\Sidebar\SidebarServiceProvider' not found
Also was trying to do composer dump-autoload but it doesn't helped.
I've figured out whats wrong, theres no autoload seciton for workmench directory in bootstrap/autoload.php
I've add it and not everything ok.
if (is_dir($workbench = __DIR__.'/../workbench'))
{
Illuminate\Workbench\Starter::start($workbench);
}

"An error occured when executing the cache:clear --no-warmup" while installing symfony-cmf-standard

I was trying to install symfony-cmf-standard using:
composer.phar create-project symfony-cmf/standard-edition symfony-cmf-standard/ --stability=dev
But I am getting the following error:
Could not open input file: app/console
Script sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occured when executing the cache:clear --no-warmup
I am running the command as an Administrator so it should not be a permission issue.
It gives error as when we use the command,
composer.phar create-project symfony-cmf/standard-edition symfony-cmf-standard/ --stability=dev
It creates symfony-cmf-standard folder as a project folder and starts installing dependencies but in between it tries to clear cache using
php app/console cache:clear
But as the current location is outside of the project folder it can not locate app/console so it fails.
Now if we change the directory to inside the project folder and clear cache manually by using command
php app/console cache:clear
It clears cache and then we need to again update dependencies using
php composer.phar update
It worked for me.
I've got an error cut also in the same case: "...PHP Fatal error: Class 'DOMDocument' not found..."
Works after:
install php-xml (can be optionally compiled with this option I suppose)
set date.timezone in /etc/php.ini
On my side with php7.0 I had to install :
php7.0-mbstring
php7.0-xml
Then it worked :)
This happens because of the following bug in DoctrinePHPCRBundle: https://github.com/doctrine/DoctrinePHPCRBundle/issues/17
To fix it, edit the file vendor/doctrine/phpcr-bundle/Doctrine/Bundle/PHPCRBundle/Resources/config/odm.xml inside your symfony-cmf-standard folder and replace this line:
<parameter key="doctrine_phpcr.odm.metadata.driver_chain.class">Doctrine\ODM\PHPCR\Mapping\Driver\DriverChain</parameter>
With this one:
<parameter key="doctrine_phpcr.odm.metadata.driver_chain.class">Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain</parameter>
Now copy composer.phar inside your symfony-cmf-standard folder and run with administrator privileges the command:
php composer.phar update
Make sure these are installed:
php-mb or php54w-mbstring or php55w-mbstring
php-xml or php54-xml or php55w-xml
After spending a couple hours on the issue, under FreeBSD you need to install port textproc/php80-xmlreader as well.

Categories