Skip to main content
GrN.dk

Main navigation

  • Articles
  • Cases
  • Contact
  • Your Digital Project Manager
  • About Greg Nowak
  • Services
  • Portfolio
  • Container
    • Excel Freelancer
    • Kubuntu - tips and tricks
    • Linux Apache MySQL and PHP
    • News
    • Image Gallery
User account menu
  • Log in

Breadcrumb

  1. Home

Composer Tips for Drupal Teams: Safer Installs, Cleaner Updates

By Greg Nowak. Last updated 2026-07-07.

Composer is not just a developer convenience in a Drupal project. It is part of the delivery system. It decides what gets built, which versions the team shares, and whether staging, production, and local environments can be explained without guesswork.

For business owners, operations leads, and agency teams, that matters because dependency drift is rarely visible until it becomes a missed release window, a fragile handover, or an emergency update that cannot be reproduced. The aim is not to make Composer complicated. The aim is to make it boring, reviewable, and dependable.

Use a safer Composer install habit

If you maintain servers, CI images, or developer onboarding notes, avoid treating root access as the normal Composer workflow. Composer can execute third-party code through plugins and scripts during commands such as install and update, so it should usually run as the project user, not as superuser.

For a user-level install, put Composer somewhere on the user PATH and verify the installer before running it. The checksum changes over time, so do not paste an old hard-coded 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');"

If you are evaluating untrusted dependencies, use a container or another isolated environment. Passing --no-plugins --no-scripts can reduce execution during an install or update, but it is not a substitute for isolation when the code itself is not trusted.

Start Drupal projects from the right template

The old drupal-composer/drupal-project:8.x-dev approach should not be the default for modern Drupal 10 or 11 work. New projects should start with Drupal’s recommended Composer template:

composer create-project drupal/recommended-project my_site_name

That structure keeps composer.json, composer.lock, and vendor outside the public web root, while placing web-accessible files in /web. This is a practical security and operations detail: it makes hosting configuration clearer and reduces the chance that private project files are exposed.

If you need to rename the web root or adjust installer paths before dependencies are installed, start with --no-install, make the intended change in composer.json, then install.

composer create-project --no-install drupal/recommended-project my_site_name
cd my_site_name
composer install
Situation Composer habit Why it helps
New Drupal build Use drupal/recommended-project Keeps public files in /web and dependencies outside the document root.
Adding modules Use composer require Updates constraints and the lock file in one reviewable change.
Upgrade planning Run composer outdated and composer audit Shows update pressure, advisories, abandoned packages, and policy issues early.
Blocked update Use composer why and composer why-not Identifies the package or platform constraint causing the conflict.
Drush management Keep Drush in the project Prevents global tool versions from drifting away from the site they manage.
A practical Composer baseline for Drupal teams that need predictable delivery, not dependency surprises.

Check versions before adding packages

A small amount of checking before require saves a lot of cleanup later. Drupal modules often have stable releases, development branches, and pre-release versions available at the same time. Before adding a module to a production project, inspect what Composer can actually resolve.

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

Then add packages through Composer rather than by manually editing files or copying code into the repository.

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

That keeps composer.lock honest. It also gives reviewers a clear dependency change instead of a vague bundle of downloaded files.

Make update checks routine

Composer has enough built-in reporting to support a simple operational rhythm. These commands are useful before release planning, before a PHP upgrade, and before a handover to another team.

composer validate
composer outdated
composer outdated 'drupal/*'
composer audit

validate catches bad or stale Composer state before it reaches CI. outdated shows which installed packages have newer versions available. audit checks installed packages against security advisories and dependency policies, including abandoned or flagged packages. None of these commands fixes the project by itself, but they turn unknown risk into a list the team can plan around.

Debug conflicts instead of guessing

When Composer refuses an update, resist the temptation to loosen random constraints until the command passes. Start by asking Composer why the current package is installed and what blocks the version you want.

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

why shows dependency paths. why-not and prohibits show which packages block a target version or platform requirement. This is especially useful when planning PHP upgrades, where the blocker may be a transitive library rather than the Drupal module everyone is looking at.

Keep Drush tied to the project

The older habit of deleting vendor/drush by hand is not a maintainable fix. Current Drush guidance is straightforward: Drupal sites should be Composer-managed, and Drush should be a dependency of the project.

composer require drush/drush
vendor/bin/drush status

Use the major version that matches the Drupal site. As of the current Drush install documentation, Drush 13 is the supported and recommended line for Drupal 10.2+, while Drush 14 is the supported and recommended line for Drupal 11.3+. Pinning the major version is sensible for teams managing several sites, because it avoids surprise tool changes during a release cycle.

composer require drush/drush:^13
# or, for a compatible Drupal 11.3+ project:
composer require drush/drush:^14

Composer discipline is not about ceremony. It is about having a build that another developer, agency, or hosting partner can reproduce without private knowledge. If your Drupal estate needs cleaner dependency management, safer upgrades, or a calmer release process, Greg can help put a practical workflow around it.

Related on GrN.dk

  • Copy and Paste Images from the Clipboard in Drupal
  • Drupal's June security bundle exposes fragile Composer update habits
  • Sending Mail with Drupal: Reliable Email Setup for Business Sites

Need help with this kind of work?

Get help with Drupal delivery Get in touch with Greg.

Sources

  • Composer: How do I install Composer programmatically?
  • Composer: Command-line interface / Commands
  • Composer: How do I install untrusted packages safely?
  • Drupal.org: Using Composer to Install Drupal and Manage Dependencies
  • Drush: Install
Last modified
2026-07-07

Tags

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

Review Greg on Google

Greg Nowak Google Reviews

 

Illustrated infographic summarizing: Shorter TLS certificates expose every renewal you never automated
Shorter TLS certificates expose every renewal you never automated
2026-07-26

Shorter TLS lifetimes leave less room for manual handoffs and faulty deploy hooks. Build a renewal path that protects service availability.

Illustrated infographic summarizing: One Timeout, Two Orders: Make AI Actions Safe to Retry
One Timeout, Two Orders: Make AI Actions Safe to Retry
2026-07-25

A timed-out AI action may already have succeeded. Stable keys, durable ledgers, queues and stored results prevent a routine retry from duplicating real work.

Illustrated infographic summarizing: Your AI Visibility Dashboard Needs a Methodology, Not More Charts
Your AI Visibility Dashboard Needs a Methodology, Not More Charts
2026-07-24

A practical framework for measuring AI-search visibility with fixed prompts, repeated tests, separate metrics, retained evidence, and honest reporting.

Illustrated infographic summarizing: AI Admin APIs Are Here—But Your Directory Is Still the Source of Truth
AI Admin APIs Are Here—But Your Directory Is Still the Source of Truth
2026-07-23

New AI admin APIs can automate access and spend controls, but reliable governance still starts with authoritative directory data and clear ownership.

Illustrated infographic summarizing: OpenAI Presence Arrived—But Is Your Workflow Ready for an Agent?
OpenAI Presence Arrived—But Is Your Workflow Ready for an Agent?
2026-07-22

Before an AI agent can take on real work, its workflow needs clear scope, permissions, handoffs, evaluation cases, and production monitoring.

Illustrated infographic summarizing: Chatbot Transcripts Quietly Became a Retention and Redaction Problem
Chatbot Transcripts Quietly Became a Retention and Redaction Problem
2026-07-21

Chatbot transcripts spread across providers, logs and support tools. Here is how to map each copy, redact sensitive data and test deletion properly.

Illustrated infographic summarizing: Cloudflare Service Keys Stop in September: Find Every Caller
Cloudflare Service Keys Stop in September: Find Every Caller
2026-07-20

Cloudflare Service Keys stop working on September 30, 2026. Here is how to find every caller, move to scoped API tokens and avoid a late outage.

Illustrated infographic summarizing: Your AI Workflow Needs an Acceptance Test Before It Meets Customers
Your AI Workflow Needs an Acceptance Test Before It Meets Customers
2026-07-19

A practical way to test AI workflows using realistic scenarios, tool checks, human rubrics, regression suites, and clear release gates.

Three cover candidates for The Goats Were Load-Bearing fanned on a dark background: an ember-lit door, three slow knocks, and a founders' ledger
The Goats Were Load-Bearing: a fantasy where the bill always comes due
2026-07-19

A teaser for the upcoming darkly comic fantasy novel The Goats Were Load-Bearing — a village, a door that must stay poor, and the worst possible time to sell the herd. Readers pick the cover.

Vegan Power game: the yellow player catches falling fruit while a chicken and a cow look on
Vegan Power: The Little Game About Eating Fruit, Not Friends
2026-07-19

Vegan Power is a free browser game where you catch fruit, dodge the animals, protect seven hearts, and chase a better high score.

More articles
RSS feed

GrN.dk web platforms, web optimization, data analysis, data handling and logistics.