2
votes

While installing laravel on windows via laravel installer with command composer global require "laravel/installer=~1.1" then laravel new project-name , it now instal laravel 5.0, latest version. How to install laravel 4.2 version via laravel installer with laravel new command??

7

7 Answers

10
votes

No that's not possible with the laravel installer. It will always get the latest release. Here's the source of the laravel new command

protected function download($zipFile)
{
    $response = \GuzzleHttp\get('http://cabinet.laravel.com/latest.zip')->getBody();
    //                                                      ^^^^^^^^^^
    file_put_contents($zipFile, $response);
    return $this;
}

What you can do is use composer create-project and specify the version:

composer create-project laravel/laravel project-name ~4.2.0 --prefer-dist

By the way ~4.2.0 means that you will get the latest version with 4.2.* (currently that's 4.2.11)

3
votes

This works for me on top of homestead:

$ composer create-project laravel/laravel YOURFOLDERNAME 4.2.*

Note the * for the version #.

Outputs:

Installing laravel/laravel (v4.2.11)
  - Installing laravel/laravel (v4.2.11)
    Downloading: 100%  
1
votes

If you don't plan to create multiple 4.2 projects, you can install single one by issuing another Composer command:

composer create-project laravel/laravel foldername "4.2" --prefer-dist

where foldername is a name of folder for your project and "4.2" specifies version to install.

I tried it on my Windows 7 machine just now, it works.

P.S. Laravel documentation shows slightly different syntax:
composer create-project laravel/laravel "4.2" --prefer-dist
but this creates 5.0 installation in folder named "4.2".

0
votes
  1. Delete XAMMP and/or Homestead
  2. Install Laragon (http://laragon.org/)

This should solve the problem. Happy Programming

0
votes

This should do the work.

composer create-project laravel/laravel {{projectName}} 4.2.* --prefer-dist
0
votes

Download git bash

cd /opt/lampp/htdocs 

and run

composer create-project laravel/laravel [name] 4.2.* --prefer-dist

where [name] is your projects name.

0
votes

It's better to use composer

composer create-project laravel/laravel {directory} 4.2 --prefer-dist

Just open your power shell and cd to the directory you want to run the project, and run the above command, make sure you have composer first.