How to keep plugins updated with composer

I’m a bit confused, I have my plugins installed using composer as follows, with gravity forms being a custom git repo:

“require”: {
“php”: “>=5.3.0”,
“wordpress”: “3.7.1”,
“fancyguy/webroot-installer”: “1.0.0”,
“wpackagist/advanced-custom-fields”: “*”,",
“plug/gravityforms”: “dev-master”,

But I can’t seem to update to keep everything up to date. When I run composer update, it will just reinstall what it already has, not the latest version.

You will have to update the version numbers when the plugins or core gets updated. The reason it is better to do it the way you are, then the more traditional way is that you now have control of the dependencies.

Have you looked through the Composer docs about using a rule or wildcard?

You can either declare specific versions for each dependency (more work, but under your complete control) or declare using a rule so that later versions matching the rule will be added with composer update (just remember that even minor changes can lead to major problems, but that’s what a dev/staging environment is there for).

Sorry I’m a bit lost with the answers given and the wildcard documentation. There’s no way for me to write ‘composer update’ and it to just download the latest versions, without me having to manually change them in the composer.json file?

And yes, I do use a dev and staging server for testing before it goes live :smile:

There is a way to use composer update and it will update to the latest version. In the documentation it says: You can specify a pattern with a * wildcard. 1.0.* is the equivalent of >=1.0,<1.1. This means that you can specify any part of the version with a {}, this star is the wildcard. The wildcard “sign” will make composer get the latest version of that specific part of the version number. So if I want to get wordpress 3 and don´t really care which subversion of wordpress you get, as long as it is the latest one (“wordpress”: "3..*"). You could in theory just assign a wildcard * as the version number and composer will get you the latest version of that dependency, but this kind of brakes the point of Composer. The reason that you want to specify the version is that you know what depends on what and that it works.

Yeah, but I’d just like to write update and a bunch of my plugins update on my local copy to the latest version, then I can test them out locally.

I read the stuff about the wildcards, but still don’t understand it.

Does it only work for versions, like do I need to use 1.*, and then change it when a version with 2 comes out? Is there no way to just say latest version?

I believe putting @dev for the version should always get the latest.

For reference, you’re correct about 1.* though. That would never get a version starting with 2.