Install specific version using laravel installer - laravel

As of now, if I use this command
laravel new blog
It will create a laravel project with the latest version like 5.2, but what if I want to install a specific version, ie. version 5.1?
UPDATE:: I am looking for laravel installer command, is there is any option/parameter for specific version installation?

Using composer you can specify the version you want easily by running
composer create-project laravel/laravel="5.1.*" myProject
Using the 5.1.* will ensure that you get all the latest patches in the 5.1 branch.

use
laravel new blog --version
Example laravel new blog --5.1
You can also use the composer method
composer create-project laravel/laravel app "5.1.*"
here, app is the name of your project
please see the documentation for laravel 5.1 here
UPDATE:
The above commands are no longer supports so please use
composer create-project laravel/laravel="5.1.*" appName

You can use composer method
like
composer create-project laravel/laravel blog "5.1"
Or here is the composer file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}

use laravel new blog --5.1
make sure you must have laravel installer 1.3.4 version.

The direct way as mentioned in the documentation:
composer create-project --prefer-dist laravel/laravel blog "6.*"
https://laravel.com/docs/6.x/installation

Via composer installing specific version 8.*
composer create-project laravel/laravel:^8.* project_name
using composer installing specific version 7.*
composer create-project --prefer-dist laravel/laravel:^7.0 project_name
To install specific version 6.* and below use the following command:
composer create-project --prefer-dist laravel/laravel project_name "6.*"

Year 2022
Since Laravel 5.2 (2017) it is not possible to install a specific Laravel Version via Laravel Installer. Use instead composer create-project. For example:
composer create-project --prefer-dist laravel/laravel blog "7.*"
// That will install Version the latest version of Laravel 7.
// would install:
"laravel/framework": "^7.29",
composer create-project --prefer-dist laravel/laravel blog "5.*"
// would install:
"laravel/framework": "5.8.*",
composer create-project --prefer-dist laravel/laravel blog
Would install the latest Laravel version on your local machine.

For newer version of laravel:
composer create-project --prefer-dist laravel/laravel=5.5.* project_name

From Laravel 6, Now It's working with the following command:
composer create-project --prefer-dist laravel/laravel:^7.0 blog

you can find all version install code here by changing the version of laravel doc
composer create-project --prefer-dist laravel/laravel yourProjectName "5.1.*"
above code for creating laravel 5.1 version project.
see more in laravel doc. happy coding!!

you can use this command
composer create-project laravel/laravel:^8.*.* exam-app

composer create-project --prefer-dist laravel/laravel project_name "version_num"
Example ::
suppose, i would like to create a new project called- blog
where i would like to use laravel 6.0 LTS version,,
following that command
composer create-project --prefer-dist laravel/laravel blog "6.*"

Another possibility is to
laravel new my-project --branch 9.x

Related

Can't upgrade Magento 2?

Hi Stackoverflow
Im having problem updating Magento 2.1.6 to 2.2.1 because our theme requires that version atleast. When i try to update by SSH i get the follow error:
As seen above it return an error. Ive been looking everywhere and i cant seem to figure out what the problem could be?
Below you see some of my composer.json where i tried to input the needed infomrations for the update.
"name": "magento/magento2ce",
"description": "Magento 2 (Community Edition)",
"type": "project",
"version": "2.2.1",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"require": {
"magento/product-community-edition": "2.2.1",
"composer/composer": "#alpha"
},
Hope you guys can help :)
Step A: Access Your Server using SSH
Step B: Navigate to the Magento 2 Root directory
Step C: Upgrade Commands
composer require magento/product-community-edition 2.2.1 --no-update
Then execute this all commands
composer update
rm -rf generated
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento indexer:reindex

Composer install using Homestead gives error "Your requirements could not be resolved to an installable set of packages"

I am trying to install my composer packages using the following command:
composer install --no-dev --no-scripts
The composer.json file looks like this (it's very similar to the standard Laravel composer file):
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"doctrine/dbal": "^2.5",
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*",
"laravel/homestead": "^5.2",
"barryvdh/laravel-ide-helper": "^2.3"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
However when I try to install it on my production machine (which runs PHP on version v5.5.9 I get the following error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/homestead v5.4.0 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.3.2 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.3.1 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.3.0 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.2.4 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.2.1 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.2.0 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead 5.2.3 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead 5.2.2 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- Installation request for laravel/homestead ^5.2 -> satisfiable by laravel/homestead[5.2.2, 5.2.3, v5.2.0, v5.2.1, v5.2.4, v5.3.0, v5.3.1, v5.3.2, v5.4.0].
So my questions is as follows:
Why is homestead even being installed when I said --no-dev and homestead is a dev package?
If I did want to install Homestead on my production machine, how can I solve the above problem?
--no-dev should not install the dev dependencies. Check your production build scripts (or whatever you are using to run this on production), that --no-dev is indeed added.
For the second part of your question, you can avoid the error by changing laravel/homestead package version to ~4.0 or 4.0.5 to be more precise to make it compatible with your php version.

Why can't I install oauth2 client?

getting some strange errors with composer, anyone know what I can do next? I am trying to install oauth2 client on Laravel 5.1 so that I can use it to connect to an affiliate network API.
Using version ~2.2 for league/oauth2-client
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for league/oauth2-client ~2.2 -> satisfiable by league/oauth2-client[2.2.0].
- Conclusion: remove paragonie/random_compat v1.4.2
- league/oauth2-client 2.2.0 requires paragonie/random_compat ^2.0 -> satisfiable by paragonie/random_compat[v2.0.0, v2.0.1, v2.0.10, v2.0.2, v2.0.3, v2.0.4, v2.0.5, v2.0.6, v2.0.7, v2.0.8, v2.0.9].
- Can only install one of: paragonie/random_compat[v2.0.0, v1.4.2].
- Can only install one of: paragonie/random_compat[v2.0.1, v1.4.2].
- Can only install one of: paragonie/random_compat[v2.0.10, v1.4.2].
- Can only install one of: paragonie/random_compat[v2.0.2, v1.4.2].
- Can only install one of: paragonie/random_compat[v2.0.3, v1.4.2].
- Can only install one of: paragonie/random_compat[v2.0.4, v1.4.2].
- Can only install one of: paragonie/random_compat[v2.0.5, v1.4.2].
- Can only install one of: paragonie/random_compat[v2.0.6, v1.4.2].
- Can only install one of: paragonie/random_compat[v2.0.7, v1.4.2].
- Can only install one of: paragonie/random_compat[v2.0.8, v1.4.2].
- Can only install one of: paragonie/random_compat[v2.0.9, v1.4.2].
- Installation request for paragonie/random_compat == 1.4.2.0 -> satisfiable by paragonie/random_compat[v1.4.2].
Installation failed, reverting ./composer.json to its original content.
my composer.json:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"bestmomo/scafold": "dev-master",
"illuminate/html": "5.*",
"barryvdh/laravel-dompdf": "0.6.*",
"davejamesmiller/laravel-breadcrumbs": "~3.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database",
"app/helpers"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
The output of your install attempt has all the information:
Currently there is paragonie/random_compat v1.4.2 installed. Your new package requires paragonie/random_compat ^2.0 - this is an incompatible change (simply by looking at the version number, not at the code), so Composer cannot simply install the newer version.
However, some component already installed requires that older version. You can find out which one it is by running composer why paragonie/random_compat, and you can also find out why it wasn't possible to install the newer version by running composer why-not paragonie/random_compat ^2.0, which will probably output the same information.
All in all I think the suggestion on how to solve this is: Upgrade Laravel. 5.1 is rather old, and it depends on paragonie/random_compat in version ~1.4. Newer versions of Laravel (5.3 and 5.4) allow either ~1.4 or ~2.0, which would fix your issue.
I haven't looked deeper into this issue, though. It might be possible that another component also depends on this library and would also need to be updated. Laravel was my first guess.

composer + rocketeer + laravel 5.1 - cannot install rocketeer in laravel 5.1.17

I tried to install rocketeer on laravel 5.1.17 using composer but couldn't succeed.
Is it incompatible with latest version of laravel or what might be the problem?
The latest versions of the illuminate/log are 4.2.x-dev, 5.1.x-dev, and 5.2.x-dev.
This means that you want to add this line to the end of yourcomposer.json file:
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"

How can I resolve "Your requirements could not be resolved to an installable set of packages" error?

When I run composer update I receive some wired output.
Here is my composer.json look like.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.", "keywords": ["framework", "laravel"],
"license": "MIT",
"repositories": [{
"type": "vcs",
"url": "https://github.com/Zizaco/ardent.git"
}],
"require-dev": {
"phpunit/phpunit": "4.3.*"
},
"require": {
"laravel/framework": "4.2.*",
"laravelbook/ardent": "dev-master as 2.4.0",
"zizaco/entrust": "dev-master",
"sebklaus/profiler": "dev-master",
"doctrine/dbal": "dev-master"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations", "app/database/seeds", "app/tests",
"app/libraries"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
How do I fix that ?
Run this command:
composer install --ignore-platform-reqs
or
composer update --ignore-platform-reqs
Composer ignore-platform-reqs flag explanation
Your software dependencies have an incompatible version conflict.
At the same time you want to install any Laravel 4.2.x version, and "zizaco/entrust" from its master branch. And that master branch requires at least Laravel 5.0 (roughly speaking).
The problem comes from the dependency on branches. It's likely that the package zizaco/entrust once was using Laravel 4.2 in its master branch, and that you were able to install your dependencies at that day. But the very moment this branch gets updated with an incompatible version requirement, you will never ever be able to run composer update and get updated dependencies.
Always use tagged versions! Ideally you use a relaxed version requirement that allows for compatible updates. This should be expressed as a tilde-two-number version requirement: ~1.2 would install a version 1.2.0 and up (like 1.2.99 or 1.2.100), and also 1.3 and up. If you need a certain patch release: Caret-three-number version ^1.2.10 will install 1.2.10 or up, also 1.3 and up.
Using this version requirement instead of dev-master will allow you to use released versions instead of the unstable state in the master branch, and allows you to address the most recent version that still works with Laravel 4.2. I guess that would be zizaco/entrust version 1.3.0, but version 1.2 would also qualify. Go with "zizaco/entrust": "~1.2".
I am facing the same issue. I am using 'Lumen' microservice framework.
I recently resolved the same issue by installing two packages:-
sudo apt-get install php7.0-mbstring,
sudo apt-get install php7.0-xml or sudo apt-get install php-xml
After installing this, you need to execute this command:-
composer update
Hope, it will resolve the issue. I work on my system.
The simplest solution is adding --ignore-platform-reqs flag.
If you are running composer install or composer update use it with --ignore-platform-reqs flag
Example
composer install --ignore-platform-reqs
Or
composer update --ignore-platform-reqs
And this should do the trick!
I use Windows 10 machine working with PHP 8 and Lavarel 8 and I got the same error, I used the following command :-
composer update --ignore-platform-reqs
to update all the packages regardless of the version conflicts.
Were those dev-masters added automatically? Avoid them as unnecessary version constraints, for 'any suitable version' use "*", or "#dev" if you don't mind dev packages. My guess is that Entrust is the potential troublemaker.
Also, "minimum-stability": "stable" imposes additional constraints, and
"minimum-stability": "dev",
"prefer-stable": true
is more conflict-free, consider it a rule of thumb.
I solved the same issue setting 'laravel/framework' dependency version from "^8.0" to "^7.0".
After that running composer update --ignore-platform-reqs simply worked
composer.json
I am facing the same issue in Laravel v8.49.0 (PHP v8.0.6). Using Composer through install packages
I recently resolved the same issue by installing two packages:-
composer create-project laravel/laravel myapp
Composer Update
composer update --ignore-platform-reqs
OR
composer install --ignore-platform-reqs
Check Start Server
php artisan serve
You must be in the correct directory so cd into it, then:
composer update --ignore-platform-reqs if you have previous installed composer as Vivek M suggests. My problem was wrong directory.
cd into: xampp/htdocs/laravelProjects/laravelP1
Add "barryvdh/laravel-cors": "^0.7.3" at the end of require array inside composer.json
Save composer.json and run composer update
You are done !
I solved the same error, by adding "zizaco/entrust": "*" instead of the "zizaco/entrust": "~1.2".
Install the following according to the PHP version installed on your system:
sudo apt-get install php8.0-curl php8.0-gd php8.0-xsl php8.0-dom
Finally try again to create the laravel project with composer
composer create-project laravel/laravel myProject
I encountered this problem in Laravel 5.8, what I did was to do composer require for each library and all where installed correctly.
Like so:
instead of adding it to the composer.json file or specifying a version:
composer require msurguy/honeypot: dev-master
I instead did without specifying any version:
composer require msurguy/honeypot
I hope it helps, thanks
"config": {
"platform": {
"ext-pcntl": "7.2",
"ext-posix": "7.2"
}
}
If you are using php ^8.0
open list of available php versions
sudo update-alternatives --config php
switch to on of the older versions above PHP 7.2, select one of them
then update composer
composer update
CAUSE:
The error is happening because your project folder is owned by the root user.
SOLUTION
Change ownership to the currently signed in user and not the root user. If you only have root as the sole user, create another user with root privileges.
$ sudo chown -R current_user /my/project/directory/
then
$ composer install
Just activate the curl in the php.ini file
;extension=php_curl.dll
to
extension=php_curl.dll
and then composer install

Resources