Skip to main content
Home
GrN.dk

Main navigation

  • Articles
  • Cases
  • Services
  • Your Digital Project Manager
  • About Greg Nowak
  • Image Gallery
  • Contact
User account menu
  • Log in

Join my community / free newsletter — sign up here

Breadcrumb

  1. Home

Composer for Drupal Teams: Safer Installs, Cleaner Updates

Illustrated infographic summarizing: Composer for Drupal Teams: Safer Installs, Cleaner Updates

By Greg Nowak. Updated 6 August 2026.

Composer is part of a Drupal site’s delivery system, not merely a developer utility. It determines which code enters the project, whether another team can reproduce the build, and how safely an urgent update can move from development to production.

That makes Composer discipline a business concern. A weak process creates dependency drift, opaque handovers, and releases that work on one developer’s machine but fail in CI or production. A good process is deliberately uneventful: every change is visible, reviewable, tested, and recoverable.

Treat the lock file as a release artifact

The distinction between composer update and composer install is fundamental. An update resolves new package versions and rewrites composer.lock. An install uses the exact versions already recorded in that lock file.

Run updates in a development branch, review both composer.json and composer.lock, and commit them together. CI, staging, and production should then build from the committed lock file:

composer install --no-dev --optimize-autoloader
composer check-platform-reqs

The second command checks the real PHP version and extensions in the target environment. It catches a class of deployment failures that can be hidden when a developer’s machine and production server differ.

Start new Drupal projects with the supported structure

For modern Drupal 10 and 11 sites, use Drupal’s recommended project template:

composer create-project drupal/recommended-project my_site_name

This places web-accessible files in /web, while keeping composer.json, composer.lock, and vendor outside the document root. Hosting and deployment configuration must point to that /web directory.

If the team needs to rename the web root or adjust installer paths before downloading dependencies, create the project without installing first:

composer create-project --no-install drupal/recommended-project my_site_name
cd my_site_name
# Edit composer.json as required, then:
composer install

Run Composer with the right level of trust

Composer plugins and scripts can execute third-party code during commands including install and update. Avoid running Composer as root during normal development or deployment. Use a dedicated project or build user with only the permissions it needs.

When installing Composer programmatically, retrieve the current installer checksum instead of copying a hash into permanent documentation:

mkdir -p "$HOME/.local/bin"
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
  echo "Invalid Composer installer checksum" >&2
  rm composer-setup.php
  exit 1
fi

php composer-setup.php --install-dir="$HOME/.local/bin" --filename=composer
php -r "unlink('composer-setup.php');"

For unfamiliar or untrusted packages, use a disposable container or equivalent sandbox. The flags --no-plugins --no-scripts reduce execution during dependency resolution, but Composer’s own guidance makes clear that they do not replace isolation.

Stage Recommended action Decision it supports
Before planning composer validatecomposer outdated 'drupal/*'composer audit Is the project healthy, and what requires attention?
Before changing Create a branch and take a recoverable database backup Can the release be tested and reversed?
During resolution Update only the intended packages Is the dependency change small enough to review?
In CI or staging Run composer install from the lock file and execute project tests Can another environment reproduce the build?
At release Deploy the tested artifact and run the agreed Drupal deployment steps Are code, database updates, and configuration moving together?
A controlled Composer workflow keeps dependency selection separate from production deployment.

Add packages without hiding the decision

Before adding a module, inspect its available releases and Drupal compatibility. Stable, pre-release, and development versions may coexist:

composer show drupal/video_filter --available
composer show drupal/video_filter --all

Add production and development dependencies explicitly:

composer require drupal/pathauto drupal/metatag
composer require --dev drupal/devel

Do not copy contributed modules into the repository manually. Composer records the constraint, resolves transitive dependencies, and creates a lock-file change that reviewers can examine. Before accepting a package, also check its maintenance status, supported Drupal versions, release history, and security coverage on Drupal.org.

Keep updates narrow and observable

A blanket composer update can change far more than the ticket describes. Prefer a targeted update and inspect the proposed operations before applying them:

composer update drupal/pathauto --with-all-dependencies --dry-run
composer update drupal/pathauto --with-all-dependencies

The wider --with-all-dependencies option is sometimes necessary, but it can update related root requirements. Read the operation list and the lock-file diff. The aim is not the smallest possible diff at any cost; it is a change whose scope the team understands and can test.

Make these checks part of release preparation rather than an occasional rescue exercise:

composer validate
composer outdated 'drupal/*'
composer audit

composer audit should feed a triage process, not merely produce a report. Record who owns each finding, whether a supported update exists, and when the decision will be revisited.

Ask Composer why an update is blocked

When dependency resolution fails, avoid loosening unrelated constraints until something passes. Ask Composer to show the dependency path and blocker:

composer why -t drupal/file_mdm_exif
composer why-not drush/drush 14.0.0
composer prohibits php 8.3

These commands distinguish a direct constraint from a transitive dependency or PHP-platform problem. That evidence makes estimates clearer and helps an agency explain whether the real work is a package update, a module replacement, or a broader platform upgrade.

Keep Drush inside each Drupal project

Drush should be managed as a project dependency and executed from the project:

composer require drush/drush
vendor/bin/drush status

Do not rely on one global Drush installation for a mixed portfolio of sites. As of August 2026, the official compatibility matrix recommends Drush 13 for Drupal 10.2+ and Drupal 11, while Drush 14 targets Drupal 11.3+ and requires PHP 8.3+. Check that matrix when planning an upgrade rather than selecting a major version from memory.

The operational payoff from Composer is straightforward: another developer, agency, or hosting partner can reconstruct the site without private knowledge. If your Drupal estate needs more predictable upgrades, clearer ownership, or a calmer release process, Greg can help establish a practical delivery workflow.

Related on GrN.dk

  • PHP Front-Page Detection: Safer Checks for Real-World Sites
  • How to Check Whether a PHP Constant Is Defined (Without Breaking Production)
  • Sending Mail with Drupal: Reliable Email Setup for Business Sites

Need help with this kind of work?

Discuss your Drupal delivery workflow Get in touch with Greg.

Sources

  • Composer: Command-line interface and commands
  • Composer: Installing untrusted packages safely
  • Composer: Programmatic installation
  • Drupal.org: Using Composer to install Drupal and manage dependencies
  • Drush 14: Installation and Drupal compatibility
Last modified
2026-08-06

Tags

  • Composer
  • Drupal
  • php
  • DevOps
  • Log in to post comments

Review Greg on Google

Greg Nowak Google Reviews

 

Written recommendations from Trafik og Veje, Aarhus Municipality (2011) and AgroTech (2010) — read them on LinkedIn.

Illustrated infographic summarizing: From Supplier PDFs to Product Data: Where AI Needs a Second Check
From Supplier PDFs to Product Data: Where AI Needs a Second Check
2026-09-07

Supplier files need more than extraction. Here’s how to check coverage, match SKUs, resolve unclear units and prices, and test product data before a catalogue import.

Illustrated infographic summarizing: Shorter TLS Certificates: Will Your Renewal Setup Keep Up?
Shorter TLS Certificates: Will Your Renewal Setup Keep Up?
2026-09-06

Shorter TLS certificates leave less room for renewal problems. Check domain validation, scheduling, deployment and the certificate your customers actually receive.

Illustrated infographic summarizing: Your AI Image Has Content Credentials. Will Your Website Keep Them?
Your AI Image Has Content Credentials. Will Your Website Keep Them?
2026-09-05

AI image credentials can disappear during routine website processing. Learn how to test your CMS, optimizer, CDN, and publishing workflow end to end.

Illustrated infographic summarizing: What Are Customers Asking? Let AI Find the Patterns in Support Tickets
What Are Customers Asking? Let AI Find the Patterns in Support Tickets
2026-09-04

AI-based ticket analysis can uncover recurring complaints, product defects and gaps in documentation—without the company needing yet another chatbot.

Illustrated infographic summarizing: OpenAI Has Machine Identity Now. Which Jobs Should Lose API Keys?
OpenAI Has Machine Identity Now. Which Jobs Should Lose API Keys?
2026-09-03

OpenAI’s X.509 workload identity can replace API keys for the right workloads. This practical framework helps teams decide where to start safely.

Illustrated infographic summarizing: WordPress 7.1 Exposes AI-Ready Actions. Who Gets to Run Them?
WordPress 7.1 Exposes AI-Ready Actions. Who Gets to Run Them?
2026-09-02

WordPress 7.1 helps AI agents discover and invoke site abilities. Here is how to keep exposure, authentication and permission firmly separate.

Illustrated infographic summarizing: From Sales Meeting to CRM: Automate Follow-Up Without Compromising Data Quality
From Sales Meeting to CRM: Automate Follow-Up Without Compromising Data Quality
2026-09-01

How to use AI for meeting notes and follow-up while fixed rules protect CRM data, customer matching and the sales pipeline from errors and premature changes.

Illustrated infographic summarizing: Your AI Gateway Can Name the User. Decide What That Log Is For
Your AI Gateway Can Name the User. Decide What That Log Is For
2026-08-31

Identity-aware AI Gateway logs can sharpen security and cost control, but only when attribution, access, retention, guardrails, and response are clearly defined.

Illustrated infographic summarizing: Zero Data Retention Is a Workflow Audit, Not a Checkbox
Zero Data Retention Is a Workflow Audit, Not a Checkbox
2026-08-30

Zero Data Retention covers the provider, not every copy in your stack. See how to audit endpoints, logs, storage, deletion and project-level controls.

Illustrated infographic summarizing: MCP 2026-07-28 Is an Auth Migration, Not a Version Bump
MCP 2026-07-28 Is an Auth Migration, Not a Version Bump
2026-08-29

MCP’s July 2026 release removes protocol sessions and tightens OAuth. Here’s a practical plan for migrating clients, servers and enterprise access safely.

More articles

Built by AI — available for your business. The daily articles on this site are researched, written and illustrated by an autonomous AI pipeline. At nowa.dk I install the same kind of AI automation in businesses at fixed prices — site in Danish, English version here, and web/marketing agencies have a dedicated page.

RSS feed

Footer

  • All articles
  • Contact

GrN.dk — AI automation, web platforms, web optimization, data handling and logistics.

© 2026 GrN.dk · LinkedIn · Contact · AI automation in Danish: nowa.dk

Behind GrN.dk: Individual Entrepreneur Codecrafter · Tax ID 305669096 · Bakhtrioni St. 22, 0194 Tbilisi, Georgia · official business register