How do I fix Laravel Composer autoload_classmap Error - php

I've downloaded our copy of a Laravel project to my local computer. I'm running XAMP 3.2.2, PHP 5.6.19. I've installed Composer and updated the database configuration.
But as I run the project, localhost/AAAAA (AAAAA is the folder of the Laravel project), I get the error below:
Parse error: syntax error, unexpected '' => $vendorDir . '' (T_CONSTANT_ENCAPSED_STRING) in C:\xampp\htdocs\AAAAA\vendor\composer\autoload_classmap.php on line 1621
How do I fix the problem?
Thanks

You could try regenerating the composer autoload files:
php composer.phar dump-autoload
Since you just downloaded the project, you'd likely need to initiate an install first which should do this for you:
php composer.phar install
The install command will install all project dependencies into vendor/ and dump the autoload files. The package information is stored in composer.json & composer.lock.

Related

Composer not generating doctrine-migrations PHP file into vendor/bin directory

I have inherited an old legacy system based off Yii 1.1 which has had multiple development teams working on it for the past 10 years so is a bit of a mess with little to no documentation.
Doctrine Migrations have been used in the past and I can get this working on Docker, however on the live EB/EC2 instance, the migrations files will not run from command line.
Command:
php vendor/bin/doctrine-migrations status
Throws error
PHP Warning: require(/var/app/current/site/vendor/bin/doctrine-migrations.php): failed to open stream: No such file or directory in /var/app/current/site/vendor/bin/doctrine-migrations on line 8
PHP Fatal error: require(): Failed opening required '/var/app/current/site/vendor/bin/doctrine-migrations.php' (include_path='.:/usr/share/pear7:/usr/share/php7') in /var/app/current/site/vendor/bin/doctrine-migrations on line 8
Looking at my local environment versus the live server, no doctrine-migrations.php file has been created in vendor/bin on the dev server, which composer should have created and is the file being looked for. Composer install is run during build on every deployment but I can't figure out why it is not auto-generating this file in the vendor/bin directory - just another file called doctrine-migrations which pretty much just requires doctrine-migrations.php:
#!/usr/bin/env php
<?php
declare(strict_types=1);
namespace Doctrine\Migrations;
require __DIR__ . '/doctrine-migrations.php';
conposer install install bundle declared in your composer.lock file.
Your composer.lock file is generated when doing your first composer install or a composer update or composer require
Difference may occur between your local environment and production environment.
Indeed, on local, composer install install some bundle only needed in dev mode (see your require-dev part in composer.json)
Either the composer.lock file is not up to date with your composer.json file (if composer.json contain the required bundle) either the required bundle is set as require-dev
To install it, you can run composer install doctrine/doctrine-migrations-bundle

Installing PyroCMS error when installing in xampp (windows)

I am getting below error after downloading the package:
**In MigrateCommand.php line 58:
Too few arguments to function Illuminate\Database\Console\Migrations\MigrateCommand::__construct(), 1 passed in C:\xampp\htdocs\pyro\vendor\anomaly\streams-platform\src\Database\Migration\MigrationServiceProvider.php on line 88 and exactly 2 expected**
Above error is generated when entering the command
php artisan install
I had the Same issue! It looks that composer.lock file and your php version are not compatible.
I deleted the composer.lock file that comes with the repo, and the vendor project, after run composer install and then php artisan install.
I hope it works for you!

How to add /import sample Laravel Project?

After familiar with Codeigniter, I stared to learn Laravel.
I able to install Laravel using following command.
composer create-project --prefer-dist laravel/laravel blog
It works fine. :-)
Next I tried to setup sample Laravel project. I found a sample project from here (https://github.com/evercode1/sample-project).
What I did is I just download it and copied all folders to Xampp htdocs folder.
Then I visit the "http://localhost/sample-project-master/public/".
It gives following error.
Warning:
require(D:\xampp\htdocs\sample-project-master\bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
D:\xampp\htdocs\sample-project-master\bootstrap\autoload.php on line
17
Fatal error: require(): Failed opening required
'D:\xampp\htdocs\sample-project-master\bootstrap/../vendor/autoload.php'
(include_path='D:\xampp\php\PEAR') in
D:\xampp\htdocs\sample-project-master\bootstrap\autoload.php on line
17
Have I done mistake when setting up already available Laravel project? How I correct following errors or what is the way to import Laravel project?
You should do:
1) Install composer dependencies
composer install
2) An application key need to be generated with the command
php artisan key:generate
3) Open Project in a Code Editor, rename .env.example to .env and modify DB name, username, password to your environment.
4) Migrate the database along with seed
php artisan migrate --seed
5) Now run the artisan serve command
php artisan serve
the first error is due to not getting file path for bootstrap in bootstrap folder .
you should run: composer install
3 . laravel requires vendor libraries which needs to be install , it does not come automatic with the package . because it's is git ignored . so you need to install it if needed.
You should try this
composer install
OR
composer update --no-scripts
composer update
For more details please follow this link.
This means some dependencies are messing,
Open your project root folder and run this command:
composer install
or
php composer.phar install
I believe below command should work as I have tested on Windows and Linux:
composer update --no-scripts
or if you already installed and updated the composer then check below command:
composer global update
first You have to move the project to www(folder) or htdocs if using xamp or any folder that apache load the files from
then open ur terminal or cmd , and cd untill u reach prject folder , or u can do
shift + right click in the folder , a menu will come up choose "open command window here" .
then write this command composer update this will install all the packages u need to run the project .
dont forget to modify .env file with your database information .
this should work .
You are facing this issue because your system might not have composer.laravel need dependency manager.you have to install the first composer to your htdoc folder.
You can install composer using following this command,composer installNow you can install laravel using (must run this command inside your htdoc)composer global require "laravel/installer"
Now you can create project usinglaravel new YOUR_PROJECT_NAME
OR
composer create-project --prefer-dist laravel/laravel YOUR_PROJECT_NAME
Note : it is good if you install composer and laravel on global location.
Documentation Available Here : https://laravel.com/docs/5.4/installation

Laravel 5.5 install

When I try to install Laravel 5.5 with laravel new project --dev
[Symfony\Component\Debug\Exception\FatalThrowableError]
Parse error: syntax error, unexpected '<<' (T_SL), expecting ']'
It is just me or because it is not release yet?
EDIT:
Btw, it is when I try to make php artisan key:generate... If I put any key in .env it works...
Thanks
composer create-project laravel/laravel blog "5.5.*" --prefer-dist
To install Laravel 5.5 you need launch composer create-project as usual and you need to set the “dev-develop” version of the laravel/laravel package:
composer create-project --prefer-dist laravel/laravel blog dev-develop
Where:
laravel/laravel: is the package for Laravel installation;
blog: is the new directory for your new project (you can change it);
dev-develop: is the next version of Laravel.
Yuo can find more information here
https://medium.com/#robertodev/how-to-install-laravel-5-5-dev-d721873a8c89
I had the same problem.
For me even
php artisan
did not work.
I fixed it with a simple
cd /my/project/folder
composer update
php artisan key:generate
in the console.
Hope this helps.
This is happening because of your Laravel Installer version. I have faced the same problem.
Run following command:
composer global update (it will update your Laravel Installer)
If you don't want to install again, then fix by following command:
composer update (from your project directory and it will update your project files)
Additional:
Sometimes, it may cause of Composer version. You can update your composer version by following command:
composer self-update
Then you can update your project files.
Hope this answer will help you.

Symfony2 error when installing via composer

I am trying to install Symfony2 via composer on an Ubuntu server:
php composer.phar create-project symfony/framework-standard-edition /var/www/dev/myproject 2.1.7
but it fails with the following error:
- Installing doctrine/doctrine-bundle (v1.1.0)
Downloading: 100%
rm: cannot remove `/var/www/dev/myproject/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle': Directory not empty
[ErrorException]
ZipArchive::extractTo(): File name too long
Google didn't help, any idea what the problem could be?
Thanks!
try by going inside the directory where you want to install it and then execute
php composer.phar create-project symfony/framework-standard-edition myproject 2.1.7
I guess the problem had to do with the linux server being a VM and the folder I tried to install symfony2 in was a folder shared from windows (the host) ...
After rebooting that error went away (leaving me with lots of random composer errors, but those are not in the scope of this question ;))

Categories