How to fix autoload warning after update Laravel - laravel-4

C:\Users\User-PC>composer dump-autoload
How fix problem after update Laravel with command composer self-update?
Composer could not find a composer.json file in C:\Users\User-PC
To initialize a project, please create a composer.json file as described in the
http://getcomposer.org/ "Getting Started" section

composer self-update is for updating composer not for updating laravel. So if you want to update laravel you need to run composer update (inside the laravel dir)

Related

Why laravel installer returns command not found?

I try to install new laravel app on fresh ubuntu installation, but I got error :
master#master-laptop:/mnt/_work_sdb8/wwwroot/lar$ composer global require "laravel/installer=~1.1"
Changed current directory to /home/master/.config/composer
./composer.json has been updated
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
13 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
master#master-laptop:/mnt/_work_sdb8/wwwroot/lar$ export PATH="$PATH:~/.composer/vendor/bin"
master#master-laptop:/mnt/_work_sdb8/wwwroot/lar$ laravel new NewLivewireApp --jet
laravel: command not found
Why I got error ? Is 1.1 valid installation for mopdern laravel app?
Thanks!
you must add a composer autoloader to your OS path.
add this code to the end if you are using Linux.
export PATH="$HOME/.composer/vendor/bin:$PATH"
File:
~/.bashrc or ~/.zshrc
I find it easier to just use composers built in installer, which i use on a regularly basis.
composer create-project laravel/laravel your-app
composer create-project foo/bar command creates a new project from packagist.org
composer require foo/bar gets the module(library) from packagist.org
so you should use
composer create-project laravel/laravel mylaravelproject
for detail look at this link
https://packagist.org/packages/laravel/laravel
composer global require laravel/installer
laravel new example-app
I salved the issue with commands :
nano ~/.bash_profile
export PATH=~/.composer/vendor/bin:$PATH
source ~/.bash_profile
and it works for me !

Laravel 5.5 install not generating .env file

I have installed laravel 5.4 multiple times.
Now I'm trying to install laravel 5.5 using same command And it doesn't work.
composer create-project --prefer-dist laravel/laravel blog dev-develop
It doesn't seem to have any errors on installation, only lot of suggestions.
But no key is generated and no .env file is created.
When I try to make php artisan key:generate
/public_html/blog/.env): failed to open stream: No such file or directory
Got the same problem days a go, the problem was because composer was not updated, solved it updating composer, you can run:
composer self-update
Or you can download the latest version there, then you can create the project again and the .env file will be automatically created.
I have this version
Composer version #package_branch_alias_version# (1.0.0-beta2) 2016-03-27 16:00:34
When I run composer self-update I get
[InvalidArgumentException]
Command "self-update" is not defined.
shell command: cp .env.example .env
If you just want to make current setup work, just try doing the following:
cp .env.example .env
php artisan key:generate
But as suggested by one of the answers here, you should update your composer if you have an old version. To check your installed version, do so with composer -v
This is happening because of your Laravel Installer or Composer version. I have faced the same problem and found following 2 different solutions:
Generally, you can solve with by running composer global update command and then run composer update command from your project directory. This solution basically updates your installer and then your project.
If still, you have this problem, then you need to run composer self-update command first and then run composer update command from your project directory. It will update your composer version and then your project.
Hope this information will help you to fix.

How to Uninstall Laravel?

I am facing fatal errors regarding Artisan. I think I couldn't install laravel complete due to slow internet. Now I want to remove Laravel from root and want to have fresh installation.
Can anyone help me?
if you have installed it globally you can simply remove it by composer global remove laravel/installer
If you have installed it via composer project you simply remove the directory.
Since I was looking all around how to uninstall packages and after reading tones
of documentations here's the short how-to uninstall a workbench package in Laravel
Remove package service provider from 'providers' array in app/config/app.php
Remove the package folder in workbench/
Run:
php composer.phar dump-autoload
php artisan clear-compiled
php artisan optimize
(optional) remove all related code using the package (you'll get errors about that)
or use composer global remove laravel/installer
For me, the command that actually did the trick was: composer global remove laravel/installer

php artisan commands stop working after composer update in laravel 5.1

I was adding the html Collective class by updating composer.json with
"require": {
"laravelcollective/html": "5.1.*"
}
then I run composer update command as per the instructions from https://laravelcollective.com/docs/5.1/html first it throws a
Fetal error: Class 'Illuminate\Foundation\Application' not found in C:\wamp\www\laravel3\laravel\bootstrap\app.php on line 14
and some errors about artisan and now artisan commands are not working, even I have tried new installation of laravel.
In order to use form and html in blade template I was trying to install Collective class using the instructions of https://laravelcollective.com/docs/5.1/html site, as per instructions I put "require": { "laravelcollective/html": "5.1.*" } into composer.json and then I ran composer update in command line which didn't update my composer, instead php artisan commands stop working and I receive different errors and exceptions, to solve those issues I struggle with commands such as composer update --no-scripts, php artisan clear-compiled, composer dump-autoload etc. which didn't solve the issue at all. Then I just type following command in command line: composer require "laravelcollective/html": "5.1.*", it update composer.json file automatically, after this process I just add providers and aliases into config/app.php, and now every thing works normal.
Okay, I suspect that the composer is not updated properly. Try doing composer update now with
composer update --no-scripts
followed by,
php artisan clear-compiled
composer dump-autoload
Try composer installation again then update.
composer install
composer update
composer dumpautoload -o
This happens when an update is not completed successfully.

Laravel - Generating composer.json and artisan files?

I downlaod composer.phar and move to /usr/local/bin/ directory as composer, then I download laravel with
composer global require "laravel/installer=~1.1"
After I linked laravel to /usr/local/bin/ , I run "laravel new test" and I get
Composer could not find a composer.json file in /home/user/test
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
So laravel doesn't generate composer.json and artisan files
Can you help why?
Edit
I was going to format PC for some reasons. After I had formatted PC, I did above steps again and it worked.
laravel new hello
is working now
you should link your laravel to \composer\vendor\bin folder. After downloading the laravel installer run this command
export PATH="$PATH:~/.composer/vendor/bin"
and then run your laravel command.
If you want to install Laravel at current folder. You don't use global:
composer require "laravel/installer=~1.1"

Resources