How to update Laravel command? - php

I used this command for installing Laravel:
composer global require "laravel/installer"
For creating a project I use :
laravel new project
Today Laravel 5.7 was released, and I'm looking for installing it using the laravel command but I couldn't do it. Instead, a new laravel project was created with Laravel 5.6.33. I need some help.
Note: I can create a project with Laravel 5.7 with this command, but I need to update my required Laravel and make a project with laravel 5.7 by using the laravel command:
composer create-project --prefer-dist laravel/laravel blog

If you want to globally update Laravel to the new version just run
composer global require laravel/installer`
to update globally

Update your laravel/framework dependency to 5.7.* in your composer.json file.
Run this command
composer update
composer create-project --prefer-dist laravel/laravel blog

Try this to update laravel installer on global level:
composer global update

I think that Laravel 5.7 Installation Documentation, has the exact instructions for your problem.
Install the Laravel Installer via composer: composer global require "laravel/installer"
Run the command: laravel new <project-name>

try this command
composer create-project --prefer-dist laravel/laravel blog "5.7.*"

Related

The "no-ansi" option does not exist

I am trying to create laravel project on windows but this problem show to me and
I try update the composer.
the php version is 8.0.6,
the composer version is 2.0.14,
the laravel version is 4.2.5,
Per comments on this Github issue this is a problem with the latest version of the Symfony Console component, which is 5.3.0. Composer is based on this library, but you can downgrade to the previous version 5.2.8 with this command:
composer global require symfony/console:5.2.x
And then force the update with:
composer global update
Instead of laravel new your-project-name you should use composer create-project laravel/laravel your-project-name 4.2.*

Why do I get a laravel error while creating a new project?

When I type laravel new blog I get the following error.
In RequestException.php line 113:
Server error: GET http://cabinet.laravel.com/latest.zip resulted in a 522 Origin Connection Time-out response:
<html>
<head><title>522 Origin Connection Time-out</title></head>
<body bgcolor="white">
<center><h1>522 Origin Conne (truncated...)
Is the same error if I typ composer create-project --prefer-dist laravel/laravel blog.
And the link doesn't work if I try to go there.
Your Laravel installer is very out of date. The only way to get the latest version is to remove and install again:
composer global remove laravel/installer
composer global require laravel/installer
You need to update the installer to the latest version.
laravel-news.com/updating-the-laravel-installer
composer global require "laravel/installer:^4.0"
after update you check your version using: laravel --version and you should get output like Laravel Installer 4.0.3
try to update laravel/installer globally via:
composer global update laravel/installer
if it didn't work then you can try to remove and install it again:
composer global remove laravel/installer
composer global require laravel/installer
Check your PHP version:
php --version
It has to be >=7.3. If it isn't you have to upgrade your PHP version.
You can download the latest stable version here
If none of the above works, try this:
composer create-project --prefer-dist laravel/laravel name of your project
The simplest way to update to the next major version of the installer is via composer require to globally require it:
composer global require "laravel/installer:^4.0"
Worked for me.
Do this:
composer create-project laravel/laravel example-app
if the following fails:
composer global remove laravel/installer
composer global require laravel/installer
The latest Laravel installer will be essential to your workflow which includes support for Jetstream.
The new version also uses composer create-project behind the scenes instead of downloading an archive from Laravel’s build servers.
Update the latest version of laravel/installer with any of the following approaches:
Update to ^4.0 via composer require
composer global require "laravel/installer:^4.0"
Uninstall and Re-install the package via Composer
composer global remove laravel/installer
composer global require laravel/installer
Update the global composer.json file and run composer update
{
"require": {
"laravel/installer": "^4.0",
} }
composer global update
Verifying the Update
laravel --version
Click here to know more about updating the Laravel Installer
Am putting this issue here it may help somebody. I was using Ubuntu 20.04 and this is my approach.
i installed an older version of laravel using the command below.
composer global require "laravel/installer=~1.1"
this fixed my $PATH
keep in mind that this installs an older version of laravel.
After all the above i removed the laravel using the command below
composer global remove laravel/installer
then re-installed it using the command below
composer global require laravel/installer
With all this done you should be running your laravel just fine plus it will be up-to-date.
The workaround of this problem is getting latest version of Laravel Installer as per New Laravel Installer via composer global require "laravel/installer:^4.0"
verify the version using $ laravel -v
It should return "Laravel Installer 4.1.0"
If you use laravel homestead, maybe you should update the box itself.
Dont forget to backup your databases.
From the directory where Homestead is installed, run the update command:
vagrant box update
vagrant destroy
vagrant up
For a more detailed description, see: How to update your Laravel Homestead Box
You can run this command for install requirements of laravel installer with laravel installer:
$ composer global require laravel/installer -W
update your composer in case you have an older version by running this command composer self-update
then run this command composer global require laravel/installer to update the laravel installer.
happy coding.
Another issue I was having is that my env variable for Composer\vendor\bin was stored within a windows.old folder and I could not find username/AppData in the normal place. Make sure you show all hidden folders and select the bin folder from the right root folders.
Just try this:
It will definitely work
composer create-project laravel/laravel project_name
I had similar problem, and although I had tried this :composer create-project laravel/laravel {directory} 4.2 --prefer-dist
What I realised is that the above command is that it would only temporarily resolve the issue ,with regard specifically to the new project that you have created.But it would not resolve for your other new projects.
The correct commands to resolve your problem completely are these two:-
composer global remove laravel/installer
composer global require laravel/installer
What I realised is that you can copy-paste the two commands at the same time,but you will need to click enter button after the "remove command " {first command } has finished, so that the second command can run...remember.
After leaving the two to successfully complete, use the command,laravel -v, e.g C:\xampp\php>laravel -v , to check your update version of the laravel installer.You should be able to see something like :Laravel Installer 4.2.8
Thanks to these commands my issue was resolved.

How to update Laravel Installer for version 8.x?

I used this command for installing Laravel Installer:
composer global require "laravel/installer"
For creating a project I use :
laravel new name --jet
on 8th September laravel 8.x was released, and I'm looking for installing it using the laravel command but I couldn't do it. Instead, a new laravel project was created with Laravel 7.x. I need some help.
Note: I can create a project with Laravel 8.x with this command, but I need to update my required Laravel and make a project with laravel 8.x and jetstream by using the laravel command:
The Error looks like this.....
It will work
composer create-project --prefer-dist laravel/laravel laravel
composer require laravel/jetstream
php artisan jetstream:install inertia
/home/example_username/.config/composer go to this folder
and edit composer.json
and put
{
"require": {
"laravel/installer": "^4.0"
}
}
then run composer global update
Make sure to update your php version to >7.3 and latest Laravel Installer 4.0.3
composer global require laravel/installer
This might be helpful: https://laravel-news.com/reminder-update-your-laravel-installer
To see what version you have installed run laravel -V in your console
and if it’s less than v4.0 you’ll need to update, and we have a
tutorial on doing it, but typically it’s just a matter of running:
composer global require "laravel/installer:^4.0"

Is using the command "composer create-project laravel/laravel [name of my project]" the correct way of creating a new Laravel project?

When creating a Laravel project I use the command "composer create-project laravel/laravel [name of my project]". It takes more than 5 minutes to create and also installs Laravel. Is this the correct way of creating a new Laravel Project?
There are multiple ways to install Laravel. One of the simplest ways would be to install through composer with the command:
composer create-project --prefer-dist laravel/laravel MyAppName
// -- flag means optional
But...
It depends on your internet speed.
Even on higher internet speeds, it takes 1-2 mins
Seems related
To create a new Laravel Project via composer we need to install laravel first. Below command is used to download and install laravel using composer.
composer global require laravel/installer
Once Laravel get installed on your pc larevel new command will create a fresh Laravel installation in the directory you specify.
laravel new Project_name
Also you can create new laravel project via composer as well. (I Used to create via Composer). You can run the below command in your terminal to create new laravel project.
composer create-project --prefer-dist laravel/laravel project_name
It will take couple of minitues to create the project. Once it done go the the project directory and run the command php artisan serve to start the development server at http://localhost:8000:
Refer Laravel Documentation for more information.

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.

Categories