Skip to main content

This article works through the steps to update dependencies in the composer.json file to the latest version.

Use composer outdated to suggest the latest versions.

composer outdated

Whereas, to return a complete list of packages where packages that need an update are coloured red, the up-to-date ones are coloured green

composer show -l

 

Steps from above with responses

Updating packages to a version supported by the constraints use:

composer update

Whereas, if you want to update the constraints as well you can use:

composer require

 

Outdated

composer outdated

Response

Direct dependencies:
drush/drush                              10.6.2   11.1.1  Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours h...

Transitive dependencies:
asm89/stack-cors                         1.3.0    v2.1.1  Cross-origin resource sharing library and stack middleware
chi-teck/drupal-code-generator           1.33.1   2.5.3   Drupal code generator
consolidation/config                     1.2.1    2.1.1   Provide configuration services for a commandline tool.
consolidation/filter-via-dot-access-data 1.0.0    2.0.2   This project uses dflydev/dot-access-data to provide simple output filtering for applications built with annotated-command / Robo.
consolidation/log                        2.1.1    3.0.0   Improved Psr-3 / Psr\Log logger based on Symfony Console components.
consolidation/site-process               4.2.0    5.0.0   A thin wrapper around the Symfony Process Component that allows applications to use the Site Alias library to specify the target for a remote call.
dflydev/dot-access-data                  v1.1.0   v3.0.1  Given a deep data structure, access data by dot notation.
doctrine/cache                           1.13.0   2.2.0   PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.
doctrine/common                          2.13.3   3.3.0   PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, persistence interfaces,...
doctrine/inflector                       1.4.4    2.0.4   PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.
doctrine/persistence                     1.3.8    3.0.3   The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.
doctrine/reflection                      1.2.3    1.2.3   The Doctrine Reflection project is a simple library used by the various Doctrine projects which adds some additional functionality on top of the reflection functionality that co...
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
grasmash/expander                        1.0.0    3.0.0   Expands internal property references in PHP arrays file.
grasmash/yaml-expander                   1.4.0    3.0.2   Expands internal property references in a yaml file.
guzzlehttp/guzzle                        6.5.8    7.4.5   Guzzle is a PHP HTTP client library
guzzlehttp/psr7                          1.9.0    2.4.0   PSR-7 message implementation that also provides common utility methods
laminas/laminas-diactoros                2.11.3   2.14.0  PSR HTTP Message implementations
laminas/laminas-escaper                  2.9.0    2.10.0  Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs
laminas/laminas-feed                     2.17.0   2.18.2  provides functionality for consuming RSS and Atom feeds
laminas/laminas-stdlib                   3.7.1    3.11.0  SPL extensions, array utilities, error handlers, and more
league/container                         3.4.1    4.2.0   A fast and intuitive dependency injection container.
psr/cache                                1.0.1    3.0.0   Common interface for caching libraries
psr/container                            1.1.2    2.0.2   Common Container Interface (PHP FIG PSR-11)
psr/log                                  1.1.4    3.0.0   Common interface for logging libraries
psy/psysh                                v0.10.12 v0.11.8 An interactive shell for modern PHP.
swiftmailer/swiftmailer                  v6.3.0   v6.3.0  Swiftmailer, free feature-rich PHP mailer
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
symfony-cmf/routing                      2.3.4    3.0.1   Extends the Symfony routing component for dynamic routes and chaining several routers
symfony/console                          v4.4.44  v6.1.3  Eases the creation of beautiful and testable command line interfaces
symfony/debug                            v4.4.44  v4.4.44 Provides tools to ease debugging PHP code
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
symfony/dependency-injection             v4.4.44  v6.1.3  Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts            v2.5.2   v3.1.1  A generic function and convention to trigger deprecation notices
symfony/error-handler                    v4.4.44  v6.1.3  Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher                 v4.4.44  v6.1.0  Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts       v1.1.13  v3.1.1  Generic abstractions related to dispatching event
symfony/filesystem                       v4.4.42  v6.1.3  Provides basic utilities for the filesystem
symfony/finder                           v5.4.11  v6.1.3  Finds files and directories via an intuitive fluent interface
symfony/http-client-contracts            v2.5.2   v3.1.1  Generic abstractions related to HTTP clients
symfony/http-foundation                  v4.4.44  v6.1.3  Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                      v4.4.44  v6.1.3  Provides a structured process for converting a Request into a Response
symfony/mime                             v5.4.11  v6.1.3  Allows manipulating MIME messages
symfony/polyfill-ctype                   v1.25.0  v1.26.0 Symfony polyfill for ctype functions
symfony/polyfill-iconv                   v1.25.0  v1.26.0 Symfony polyfill for the Iconv extension
symfony/polyfill-intl-idn                v1.25.0  v1.26.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer         v1.25.0  v1.26.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring                v1.25.0  v1.26.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php80                   v1.25.0  v1.26.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/process                          v4.4.44  v6.1.3  Executes commands in sub-processes
symfony/routing                          v4.4.44  v6.1.3  Maps an HTTP request to a set of configuration variables
symfony/serializer                       v4.4.44  v6.1.3  Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.
symfony/service-contracts                v2.5.2   v3.1.1  Generic abstractions related to writing services
symfony/translation                      v4.4.44  v6.1.3  Provides tools to internationalize your application
symfony/translation-contracts            v2.5.2   v3.1.1  Generic abstractions related to translation
symfony/validator                        v4.4.44  v6.1.3  Provides tools to validate values
symfony/var-dumper                       v5.4.11  v6.1.3  Provides mechanisms for walking through any arbitrary PHP variable
symfony/yaml                             v4.4.44  v6.1.3  Loads and dumps YAML files
twig/twig                                v2.15.2  v3.4.2  Twig, the flexible, fast, and secure template language for PHP
webmozart/path-util                      2.3.0    2.3.0   A robust cross-platform utility for normalizing, comparing and modifying file paths.

 

How to update a package

Use composer require {package}.  Using the above table and updating Drush the command will be

composer require drush 11.1.1

Handy references for the composer require command:

option description
--dev Add packages to require-dev
--dry-run Simulate the command without actually doing anything
--no-progress Removes the progress display that can mess with some terminals or scripts which don't handle backspace characters
--no-update Disables the automatic update of the dependencies (implies --no-install)
--update-no-dev Run the dependency update with the --no-dev option
--update-with-dependencies (-w) Also update dependencies of the newly required packages, except those that are root requirements
--update-with-all-dependencies (-W) Also update dependencies of the newly required packages, including those that are root requirements
--ignore-platform-reqs ignore all platform requirements (php, hhvm, lib-* and ext-*) and force the installation even if the local machine does not fulfill these. See also the platform config option
--ignore-platform-req ignore a specific platform requirement(php, hhvm, lib-* and ext-*) and force the installation even if the local machine does not fulfill it. Multiple requirements can be ignored via wildcard
--prefer-stable Prefer stable versions of dependencies
--prefer-lowest Prefer lowest versions of dependencies. Useful for testing minimal versions of requirements, generally used with --prefer-stable
--sort-packages Keep packages sorted in composer.json

 

 

Related articles

Andrew Fletcher11 Apr 2022

lando COMPOSE_HTTP_TIMEOUT error

While working with lando, I had the following error ERROR: for safs_appserver_1 UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=300) ERROR: for safs_database_1 UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read...