Setup a Laravel existing project - php

I'm trying to install an existing Laravel project by running a "composer install" command but i'm getting the following errors :
PHP Fatal error: Uncaught Error: Class 'Symfony\Thanks\Command\ThanksCommand' not found in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php:58
Stack trace:
#0 /usr/share/php/Composer/Plugin/PluginManager.php(236): Symfony\Thanks\Thanks->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#1 /usr/share/php/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin(Object(Symfony\Thanks\Thanks))
#2 /usr/share/php/Composer/Plugin/PluginManager.php(261): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage))
#3 /usr/share/php/Composer/Plugin/PluginManager.php(76): Composer\Plugin\PluginManager->loadRepository(Object(Composer\Repository\InstalledFilesystemRepository))
#4 /usr/share/php/Composer/Factory.php(384): Composer\Plugin\PluginManager->loadInstalledPlugins()
#5 /usr/share/php/Composer/Factory.php(576): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false)
#6 /usr/share/php/Composer/Console/Application.php(332): C in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php on line 58
Fatal error: Uncaught Error: Class 'Symfony\Thanks\Command\ThanksCommand' not found in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php:58
Stack trace:
#0 /usr/share/php/Composer/Plugin/PluginManager.php(236): Symfony\Thanks\Thanks->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#1 /usr/share/php/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin(Object(Symfony\Thanks\Thanks))
#2 /usr/share/php/Composer/Plugin/PluginManager.php(261): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage))
#3 /usr/share/php/Composer/Plugin/PluginManager.php(76): Composer\Plugin\PluginManager->loadRepository(Object(Composer\Repository\InstalledFilesystemRepository))
#4 /usr/share/php/Composer/Factory.php(384): Composer\Plugin\PluginManager->loadInstalledPlugins()
#5 /usr/share/php/Composer/Factory.php(576): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false)
#6 /usr/share/php/Composer/Console/Application.php(332): C in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php on line 58
Can anyone help me, I am really overwhelmed

Just delete vendor folder and than run composer update command

Try using composer update and composer dump-autoload command

When you run composer install it will look for a lock file and install whatever is contained in it. Check if your composer.lock or run composer update command

Try the following steps:
Remove the vendor folder if already there
Delete the composer.lock file
Run composer install command in the terminal.

Related

Symfony error when trying to create a new project: Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read .env

Whenever I try to create a new Symfony project using the following command:
composer create-project symfony/skeleton new_project
I'm getting these error messages in the console and I have no idea what causes it:
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!! Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "C:\Users\ferra\Projects\PHPex\test_project/.env" environment file. in C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php:567
!! Stack trace:
!! #0 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php(114): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array)
!! #1 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php(157): Symfony\Component\Dotenv\Dotenv->loadEnv('C:\\Users\\ferra\\...', 'APP_ENV', 'dev', Array, false)
!! #2 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\runtime\SymfonyRuntime.php(107): Symfony\Component\Dotenv\Dotenv->bootEnv('C:\\Users\\ferra\\...', 'dev', Array, false)
!! #3 C:\Users\ferra\Projects\PHPex\test_project\vendor\autoload_runtime.php(23): Symfony\Component\Runtime\SymfonyRuntime->__construct(Array)
!! #4 C:\Users\ferra\Projects\PHPex\test_project\bin\console(11): require_once('C:\\Users\\ferra\\...')
!! #5 {main}
!! thrown in C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php on line 567
!! PHP Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "C:\Users\ferra\Projects\PHPex\test_project/.env" environment file. in C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php:567
!! Stack trace:
!! #0 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php(114): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array)
!! #1 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php(157): Symfony\Component\Dotenv\Dotenv->loadEnv('C:\\Users\\ferra\\...', 'APP_ENV', 'dev', Array, false)
!! #2 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\runtime\SymfonyRuntime.php(107): Symfony\Component\Dotenv\Dotenv->bootEnv('C:\\Users\\ferra\\...', 'dev', Array, false)
!! #3 C:\Users\ferra\Projects\PHPex\test_project\vendor\autoload_runtime.php(23): Symfony\Component\Runtime\SymfonyRuntime->__construct(Array)
!! #4 C:\Users\ferra\Projects\PHPex\test_project\bin\console(11): require_once('C:\\Users\\ferra\\...')
!! #5 {main}
!! thrown in C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php on line 567
!!
Script #auto-scripts was called via post-update-cmd
The following command: 'symfony check:requirements' shows that my system is ready to run Symfony projects:
> PHP is using the following php.ini file:
C:\xampp\php\php.ini
> Checking Symfony requirements:
..............WWW......W..
[OK]
Your system is ready to run Symfony projects
Optional recommendations to improve your setup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'm not getting any errors when I try to create a demo project instead of a regular one (symfony new --demo new_project).
Does anyone know what's causing the error message when trying to create a new regular Symfony project?
Any kind of help is appreciated.
The only solution at the moment is to create the file .env manualy at the root of your project.
I encountered the error in composer version 1. Fortunately, I was able to fix this issue by updating to the latest version of the composer.
sudo composer self-update --2

Cloning a Craft CMS project to XAMPP

I am fairly new to git and I am looking to clone a repo to XAMPP.
From what I understand I should be able to just clone it to HTDOCS and it should work if all the dependencies are installed.
I get this error message when I visit the project folder in my browser.
Fatal error: Uncaught Error: Call to a member function init() on null
in C:\xampp\htdocs\sandbox\craft\app\services\CacheService.php:114
Stack trace: #0
C:\xampp\htdocs\sandbox\craft\app\framework\base\CModule.php(394):
Craft\CacheService->init() #1
C:\xampp\htdocs\sandbox\craft\app\etc\web\WebApp.php(595):
CModule->getComponent('cache', true) #2
C:\xampp\htdocs\sandbox\craft\app\framework\base\CModule.php(103):
Craft\WebApp->getComponent('cache') #3
C:\xampp\htdocs\sandbox\craft\app\services\ConfigService.php(392):
CModule->__get('cache') #4
C:\xampp\htdocs\sandbox\craft\app\services\HttpRequestService.php(1181):
Craft\ConfigService->usePathInfo() #5
C:\xampp\htdocs\sandbox\craft\app\services\HttpRequestService.php(131):
Craft\HttpRequestService->getNormalizedPath() #6
C:\xampp\htdocs\sandbox\craft\app\framework\base\CModule.php(394):
Craft\HttpRequestService->init() #7
C:\xampp\htdocs\sandbox\craft\app\etc\web\WebApp.php(595):
CModule->getComponent('request', true) #8
C:\xampp\htdocs\sandbox\craft\app\framework\base\CMo in
C:\xampp\htdocs\sandbox\craft\app\services\CacheService.php on line
114
I know this a vague question but I'd appreciate any help.
Thank you
I think once you will clone the craft project from your git repo. You need to add .Env file into it. Then your need "uploads" folder. Also you should run the composer install command to install all the dependencies.
After all this process if you still getting the same error then you should try to remove cache from your runtime cache folder and also you can remove compiled classes and templates once.
I hope this will work.

cannot execute php artisan command [php fatal error[

I have a laravel project I installed the composer
and run
composer install
After that I executed the update command
composer update
on the project's root directory, and during the execution on the command
php artisan optimize
I got the error shown in the attached image.
When I try to execute any php artisan command I got the same error too.
Error lines
PHP Fatal error: Uncaught Error: Call to undefined method Illuminate\Support\Facades\Auth::check() in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:221
Stack trace:
#0 C:\xampp\htdocs\projectx\app\Exceptions\Handler.php(39): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(81): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 {main}
thrown in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 221
PHP Fatal error: Uncaught Error: Call to undefined method Illuminate\Support\Facades\Auth::check() in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:221
Stack trace:
#0 C:\xampp\htdocs\projectx\app\Exceptions\Handler.php(39): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(81): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#2 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(123): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#3 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#4 {main}
thrown in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 221
You could try to use the append_config() helper method in your environment app configuration file:
'providers' => append_config(array(
'LocalOnlyServiceProvider',
))
The command php artisan optimize has been remove in laravel 5.6
see more: https://laravel.com/docs/5.6/upgrade

Error after run "php artisan config:cache"

After run php artisan config:cache , show error in
Fatal error: Uncaught ReflectionException: Class config does not exist
in
D:\xampp\htdocs\app\vendor\laravel\framework\src\Illuminate\Container\Container.php:729
Stack trace: #0
D:\xampp\htdocs\app\vendor\laravel\framework\src\Illuminate\Container\Container.php(729):
ReflectionClass->__construct('config') #1
D:\xampp\htdocs\app\vendor\laravel\framework\src\Illuminate\Container\Container.php(608):
Illuminate\Container\Container->build('config') #2
D:\xampp\htdocs\app\vendor\laravel\framework\src\Illuminate\Container\Container.php(575):
Illuminate\Container\Container->resolve('config') #3
D:\xampp\htdocs\app\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(728):
Illuminate\Container\Container->make('config') #4
D:\xampp\htdocs\app\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php(106):
Illuminate\Foundation\Application->make('config') #5
D:\xampp\htdocs\app\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php(269):
app('config') #6 D:\xampp\htdocs\app\vendor\laravel\framework\src\Ill
in
D:\xampp\htdocs\app\vendor\laravel\framework\src\Illuminate\Container\Container.php
on line 729
I add this Code On bootstrap/app.php
$app->bootstrapWith([
\Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables::class,
\Illuminate\Foundation\Bootstrap\LoadConfiguration::class,
\Illuminate\Foundation\Bootstrap\HandleExceptions::class,
\Illuminate\Foundation\Bootstrap\RegisterFacades::class,
\Illuminate\Foundation\Bootstrap\SetRequestForConsole::class,
\Illuminate\Foundation\Bootstrap\RegisterProviders::class,
\Illuminate\Foundation\Bootstrap\BootProviders::class,
]);
new Error after added this code :
And run composer dumpautoload -o, it doesn't work
I added this code , it works
$app->bootstrapWith([
\Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables::class,
\Illuminate\Foundation\Bootstrap\LoadConfiguration::class,
\Illuminate\Foundation\Bootstrap\HandleExceptions::class,
\Illuminate\Foundation\Bootstrap\RegisterFacades::class,
\Illuminate\Foundation\Bootstrap\SetRequestForConsole::class,
\Illuminate\Foundation\Bootstrap\RegisterProviders::class,
\Illuminate\Foundation\Bootstrap\BootProviders::class,
]);
but i use sluggable package and set method to config file , after set command , change sluggable package method array to this :
'method' =>
Closure::__set_state(array(
)),
Now , my app doesn't work!
Because comment this code and work my code ! :(

Error in Laravel Artisan command

I am new in Laravel. I am using Laravel 5.3.I used below code to install Laravel 5.3.
php composer.phar create-project laravel/laravel=5.3 addbook dev-develop
I tried to executed "php artsisan --v" but I found below error
PHP Fatal error: Uncaught ErrorException: array_merge(): Argument #1 is not an
array in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundati
on\Exceptions\Handler.php:93
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handle
Error(2, 'array_merge(): ...', 'D:\\php7\\htdocs\\...', 93, Array)
#1 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(93): array_merge(Array)
#2 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(61): Illuminate\Foundation\Exceptions\Handler->shouldntRepor
t(Object(ErrorException))
#3 D:\php7\htdocs\addbook\app\Exceptions\Handler.php(35): Illuminate\Foundation\
Exceptions\Handler->report(Object(ErrorException))
#4 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Boo
tstrap\HandleExceptions.php(79): App\Exceptions\Handler->report(Object(ErrorExce
ption))
#5 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handle
Exce in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundatio
n\Exceptions\Handler.php on line 93
PHP Fatal error: Uncaught ErrorException: array_merge(): Argument #1 is not an
array in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundati
on\Exceptions\Handler.php:93
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handle
Error(2, 'array_merge(): ...', 'D:\\php7\\htdocs\\...', 93, Array)
#1 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(93): array_merge(Array)
#2 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(61): Illuminate\Foundation\Exceptions\Handler->shouldntRepor
t(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#3 D:\php7\htdocs\addbook\app\Exceptions\Handler.php(35): Illuminate\Foundation\
Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalErrorEx
ception))
#4 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Boo
tstrap\HandleExceptions.php(79): App\Exceptions\Handler->report(Object(Symfony\C
omponent\Debug in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate
\Foundation\Exceptions\Handler.php on line 93
Can anyone say what is the solution ??
Well, don't use the develop branch!
Run php composer.phar create-project --prefer-dist laravel/laravel=5.3 addbook.
Also, if your Composer Vendor folder is your path, you should be able to achieve the same by running
laravel new addbook
You need pull stability version, try add param --prefer-dist
composer create-project --prefer-dist laravel/laravel addbook

Categories