Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fsdolphin's avatar

Understanding what version of Laravel gets installed when version is not specified

Hi,

I have done a few installations for testing purposes and I noticed that I'm getting version 5.0.16, but when I go to Github the stable version is 5.0.32.

This is how I normally install Laravel. I start by navigating to my main development folder and installing it though composer as follow.
sudo composer create-project laravel/laravel projectName

I thought that when you don't specify the version you would get the latest stable version.

Why is that I'm not getting 5.0.32?

This is how I checked the version.
php artisan --version

Laravel Framework version 5.0.16

Side Notes:
I would to sworn that I got version 5.1 in one of my installations, but I'm not 100% sure since I accidentally deleted that installation and I couldn't verify that, but I'm almost positive that I saw 5.1 when I checked the version. What I noticed in this installation is that there was no HomeController.php nor WelcomeController.php in the Controllers folder so, I thought it was one of the changes in 5.1 but I don't think it is even released yet, right? I have been doing some new installations and now I get 5.0.16 every time which it now contains the HomeController.php and the WelcomeController.php.

Am I dreaming about Laravel 5.1? Is it even released? If yes, does it contain the HomeController.php and the WelcomeController.php?

Thanks a lot.

0 likes
23 replies
martinbean's avatar
Level 80

@fsdolphin Composer caches dependencies on a system-level basis. If you want the latest version, you can either specify the --prefer-source option when creating your project, or run composer update after you’ve created your project to check you have the most up-to-date dependencies.

1 like
davorminchorov's avatar

5.1 has not been released yet. There's no announcement either. Maybe this week?

1 like
fsdolphin's avatar

@martinbean Hmm, I don't know why one of my installations didn't have the HomeController.php or WelcomeController.php, weird.

martinbean's avatar

@fsdolphin Maybe you ran the php artisan fresh command which strips all of the boilerplate files from your project.

3 likes
fsdolphin's avatar

Sorry to resurrect this again but I just did a new installation and I noticed what I described in my original post, there is no HomeController.php nor WelcomeController.php.

This is how the routes.php looks like.

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

Is this an official change? Is this what you see when installing the latest version (5.1.6)?

FYI - This is how I did my installation.
I tried...
sudo composer create-project laravel/laravel projectName (I got version 5.1.6 LTS)
and...
sudo composer create-project laravel/laravel projectName --prefer-source (I got the same version as above, 5.1.6 LTS).

fsdolphin's avatar

@Codenator81 Oh, ok thanks.

Do you know how can I install 5.1.0?

I have tried sudo composer create-project laravel/laravel projectName 5.1.0
and sudo composer create-project laravel/laravel projectName v5.1.0

but it keeps installing 5.1.6

Codenator81's avatar

@fsdolphin

composer create-project laravel/laravel projectName 5.1.0  --no-install

in composer.json change laravel/laravel : "~5.1" to exactly 5.1.0 after that

composer install

should be what you except
p.s.

composer create-project laravel/laravel=5.1.0 your-project-name --prefer-dist 

should do job

fsdolphin's avatar

@Codenator81
For some reason I got an error when I tried composer create-project laravel/laravel projectName 5.1.0 --no-install.

ERROR:

Script php artisan key:generate handling the post-create-project-cmd event returned with an error
[RuntimeException]

Error Output: PHP Warning: require...

This is what I tried that worked.

  1. Run composer clear-cache
  2. Run sudo composer create-project laravel/laravel projectName v5.1.0.
  3. Open composer.json file and change "laravel/framework": "5.0.*" to "laravel/framework": "5.0.0".
  4. Run composer update.
  5. Done.

Why specifying the version as follow is not enough?

composer create-project laravel/laravel projectName v5.1.0

Why it installs 5.1.6 LTS and not the version specified? Ahrr, even though I really enjoy Laravel I get frustrated with these little things.

Codenator81's avatar

@fsdolphin This is nothing to do with Laravel. That is composer version management.
It is because by default in composer.json after install in your root directory:

 "laravel/framework": "5.1.*"

"5.1.*" mean last version in 5.1 branch
if you change to "5.1.0"

 "laravel/framework": "5.1.0"

end run in console

composer update

you will get 5.1.0 exactly.

1 like
fsdolphin's avatar

@Codenator81 Thank you for your help and for following alone.

The process I described above doesn't seem to update all of the files, the reason I'm saying this is because for instance I installed Laravel 5.1.6, then I changed it to 5.1.3 and no files were modified and I know for fact that the welcome splash should be different (welcome.blade.php), 5.1.3 uses the inspiring quote and 5.1.6 doesn't anymore, but as I said no files were modified when I converted it from 5.1.6 to 5.1.3.

Is this normal behavior? I thought this would update the whole project, delete, add etc., files.

Thanks.

Shaun's avatar

@fsdolphin

The first time you composer create-project laravel/laravel, you will get ALL of the files from the version you specify. This includes the app directory, as well as the resources/views directory -- including the welcome.blade.php view with the inspiring quote.

However, composer update will not modify those files in the future. You need to do that manually. Once a Laravel project is set up, each composer update you run will update the dependencies, which is basically everything you find in the vendor directory.

1 like
fsdolphin's avatar

@Shaun
Cool, thank you for the clarification.

Now, let's pretend for a moment that you really want to have 5.1.3 including the file structure that comes with it, how would you install it?

Thanks

Shaun's avatar

@fsdolphin

For your purposes, what I think you're looking for is:

composer create-project laravel/laravel my-app 5.1.3

You'll find that this installs the 5.1.3 tagged version of laravel/laravel, which has the inspiring quote in the welcome.blade.php.

Shaun's avatar

Also note that when you run php artisan -V, you will receive a reply stating that you have Laravel Framework version 5.1.6 (LTS) installed -- which is true. laravel/framework will remain the latest version in the vendor directory, but everything outside of the vendor directory (a.k.a. the laravel/laravel repository -- views, app directory, etc), will be the files that existed back in 5.1.3.

fsdolphin's avatar

@Shaun
That method doesn't really do it, Installing it using composer create-project laravel/laravel my-app 5.1.3 it actually installs 5.1.6 LTS including the file structure. It looks like defining the version does nothing.

Shaun's avatar

I tested it prior to posting.

I can confirm it gives you 5.1.3 of laravel\laravel, which has the welcome.blade.php view with the inspiring quote.

If you want 5.1.3 of laravel\framework as well, then you need to use the --no-install flag as previously mentioned. You'll get what looks like an install error from some of the Composer post-scripts (e.g. auto generating an app key), but you'll have to do those manually. Once you see the error, you will see there is no vendor directory yet -- this is to be expected. Next open your composer.json and be explicit about the version of laravel\framework you want (5.1.3). Save the file, run composer install, watch the dependencies get installed, and you'll see it install 5.1.3 as you requested.

1 like
fsdolphin's avatar

@Shaun

Hmm, I just tied it again and you are right, even though at says 5.1.6 LTS when you run php artisan -V it actually installs the right folder structure (larval/laravel).

I don't why but when I tried it earlier it didn't work, I tried it a few times.

Thanks a lot.

fsdolphin's avatar

@Shaun Thanks a lot for your help.

I don't want to make this longer but just for reference, I think that if you do multiple installations using the same name is when things get goofy. In other words if you first install composer create-project laravel/laravel my-app 5.1.6 and than delete it and than re-install a different version but using the same name composer create-project laravel/laravel my-app 5.1.3 you will keep getting 5.1.6 laravel/laravel.

I tried composer clear-cache but I don't think it makes a difference.

Please or to participate in this conversation.