Laravel Collection installation with Composer and Laravel 5 - laravel

I need help with a problem.
I'm learning Laravel 5.
And I've found a problem trying to do something.
I tried to install Laravel Collection.
I go to composer.json and I add this line on require:
"laravelcollective/html": "5.1.*"
But when I execute composer update on shell, I have an error:
Your requirements could not be resolved to an installable set of packages.
And a lot of posibles conclusions to the problem.
I put a screenshot to help you to understand.

Actually, the error messages are clear. You are trying to install a package that has a dependency of laravel componenents with a version of 5.1, but in your composer.json file, you imply that your project works with laravel 5.0. Either change the laravelcollective/html version to 5.0.* or change and upgrade your laravel dependency as 5.1.* so that your problem will be solved.

Related

How to updating laravel to 5.5.39 from 5.5.32?

I'm a newbie laravel.
Currently, Laravel had released version 5.6, but my version is 5.5.32.
And some reason, I only want to updating to 5.5.39 from 5.5.32 and do not upgrade 5.6.
I run "composer update", I see a error message.
So pls help me.
Thank you
If you want to update laravel framework to a specific version than you can easily do it as follows:-
Go to your composer.json file
There you will see in the "require" section as follows "laravel/framework": "5.5.32.*"
you just need to change it to "laravel/framework": "5.5.39.*"
save the composer.json and run composer update.
That's it. composer will read require from composer.json and update your packages likewise.
Hope this helps.

Error when changing PHP version on Heroku app

As some of you might know, PHP version ≥7.2 has an issue regarding count: count(): parameter must be an array or an object that implements Countable and this does contributes to a lot of problems.
I'm using the PHP framework Laravel 5.3 on Heroku, which until the change of PHP version worked perfectly fine. So why don't I just change the PHP version? Well, according to the docs I'm supposed to just change the version in my composer.json, run composer update and everything will be fine but no - I'm getting this error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ^5.6.4 but your PHP version (7.2.1) does not satisfy that requirement.
Anyone knowing anything that can contribute solving my problem?
You also need to push composer.lock.
Change the version in your local and make $ composer update.
Make sure you have changed composer.lock.
Push both files on Heroku.
From the documentation, https://devcenter.heroku.com/articles/php-support#php-runtimes
Next, ensure that your new requirements are “frozen” to composer.lock
by running:
$ composer update
Finally, don’t forget to git add and git commit both files!
Hope this helps.

how to safely update way generators 3.0 package in laravel 4.2

i figured out too late that way generators version 3 package is not compatible with laravel version 4.2 it only work with laravel 5, now i need to switch to a previous version of the package and i do not know how to do it properly as my laravel project is in the half way.
Thank you so much for any further help
Update your composer.json file to use "way/generators": "~2.0". Once that is done, run the following command:
composer update "way/generators" --dev
By providing the package name to the composer command, composer will only update the specified package.

composer | laravel 5 - Updating dependencies but the framework itself

I am using pre-beta release of Laravel 5 for my project.
I found out that the app skeleton of Laravel 5 was changed in the github repo and since it is a development version, that is expected to change quite frequently.
My question is, can I update only the specific dependencies using composer and not the framework itself? So that I don't have to worry about the changing app structure until I am ready to make changes?
Here is how the composer.json dependencies look:
"require": {
"laravel/framework": "~5.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"way/generators": "~3.0",
"fzaninotto/faker": "~1.5#dev"
},
Thank you.
While the composer update package package ... answer is a good one, another thing you might be able to do is change your Laravel require spec to a specific commit. The Composer documentation mentions how to do this, and I've done it myself on a project (though not with laravel, on my own packages which are also in a breaking/dev state).
"require": {
"laravel/framework": "dev-master#49e3c77b518547bb661b1de4fda64a3ae0c5c505",
...
}
I'd hope that, because laravel/framework 'replaces' the various illuminate/* packages, that any reliance on these (as long as the spec is 5.0-esque) that this would work without downloading the illuminate packages twice.
Doing it this way you can lock your laravel/framework (or any package) at a given commit, but still allow the standard composer update to work.
To find out what commit you're already on, if your laravel/framework dependency spec is a dev one then the vendor/laravel/framework/ directory itself should be a git repo, so just do git status in there to get the HEAD ref. Alternatively, look in composer.lock for the laravel/framework entry's source.reference value.
Composer allows you to do specific package upgrades. I used this literally the other night to upgrade a single package to fix a bug, but I didn't want to change anything else.
composer update <package1> <package2> <...>
So in your case
composer update phpunit/phpunit way/generators fzaninotto/faker
It might be more complicated when you have lots of packages - but it is a solution that works.
Yes, you can simply call
composer update vendor/package
without updating your whole project.
It will work for the packages pulled by yourself and for the dependencies
You can't really. If you use Laravel 5 this is a thing you need to deal with, development versions come with this backdraw.

Why are there 2 version of Laravel?

I just notice that at Github, there are 2 version of Laravel. One is this: https://github.com/laravel/laravel and the other is https://github.com/laravel/framework. One has more frequent update than the other. For example: one has laravel version 4.1.30 and 4.2.1, but the other one has version 4.1.27 and 4.2.0.
I tried to do composer install & update for laravel 4.1.* on 2 different computer. One give me version. 4.1.30, but the other give me 4.1.27.
Why is that there are two of it? What is the difference?
The first repository link in your question (https://github.com/laravel/laravel) is to build an application using Laravel 4 and you should use this (laravel/laravel) repository if you want to build an application using the Laravel framework.
On the other hand, the second one which is https://github.com/laravel/framework; it's the core code of the Laravel framework and there is a note available in that Github page as given below:
Note: This repository contains the core code of the Laravel framework.
If you want to build an application using Laravel 4, visit the main
Laravel repository.
So, if you want to contribute in the Laravel Framework then clone this repository. This is the core code repository/Laravel Framework (Kernel) and it's laravel/framework not for building an application.
Installation:
For installing the Laravel to build an application you may use:
// Via Composer Create-Project
composer create-project laravel/laravel --prefer-dist
Also you may use this (using Laravel installer and it's faster than composer install):
// Via Laravel Installer
laravel new projectname
For this, you need to download the Laravel installer PHAR archive first. For detail information, check Via Laravel Installer on Laravel website.
The recommended method of installing Laravel is via Composer with the following command:
composer create-project laravel/laravel --prefer-dist
This uses the laravel/laravel repository as the beginning for your project. One of laravel/laravel's Composer dependencies is laravel/framework, which'll get installed to your copy of laravel/laravel's vendor directory along with any dependencies you add yourself.
Everything in laravel/laravel is part of your application code - you'd tweak it, check it into your version control, etc. The stuff in laravel/framework is stuff you use, but don't touch, and it's exempted from version control.
One is the application you'd use as an end user, the other is the core packages which make up the framework.
So when you install laravel/laravel it pulls in the components from laravel/framework into the /vendor directory.

Resources