← Home ← Codex ← DEBT ← Engine
Browse by Category
+ added · ✎ updated 7d
← Back to glossary

Composer & Dependency Management

PHP PHP 5.3+ Beginner
debt(d3/e3/b5/t5)
d3 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'default linter catches the common case' (d3). The term's detection_hints.tools lists composer, dependabot, and snyk — these catch missing composer.lock, outdated dependencies, and CVEs automatically. Dependabot and composer audit are commonly integrated into CI pipelines and catch the most common mistakes (missing lock file, security vulnerabilities) without specialized configuration.

e3 Effort Remediation debt — work required to fix once spotted

Closest to 'simple parameterised fix' (e3). The quick_fix indicates straightforward remediation: commit composer.lock, switch from 'composer update' to 'composer install', add --no-dev flag, run 'composer audit'. These are configuration/command changes rather than one-line code patches, but they don't require multi-file refactoring — mostly CI pipeline and .gitignore adjustments.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). Composer applies to all PHP contexts (web, cli, queue-worker) per applies_to, making it load-bearing infrastructure. Every deployment, every new dependency, every CI run interacts with this choice. However, it's a well-understood standard tool rather than a custom architectural decision, so it doesn't quite reach b7's 'strong gravitational pull' that shapes every change.

t5 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'notable trap' (t5). The misconception explicitly states developers believe committing vendor/ is safer, when actually composer.lock is the correct artefact. This is a documented gotcha that most PHP developers eventually learn, but it contradicts the intuitive 'commit everything needed to run' instinct. The common_mistakes reinforce this — running 'update' vs 'install' and using wildcard versions are traps that aren't obvious from the command names.

About DEBT scoring →

Also Known As

Composer PHP PHP package manager composer.json

TL;DR

PHP's standard dependency manager; composer.json declares dependencies and composer.lock pins exact versions for reproducible builds.

Explanation

Composer resolves, downloads, and autoloads PHP packages from Packagist and other repositories. The composer.lock file records the exact version and hash of every installed package — committing it to version control ensures every developer and deployment uses identical dependencies. Run composer audit regularly to check for known security vulnerabilities in dependencies, use --no-dev in production installs, and verify the integrity of packages with hash checks. The vendor directory should never be committed to version control.

Common Misconception

✗ Committing vendor/ to version control is safer because it avoids network dependency. The vendor directory should be in .gitignore — composer.lock is the right artefact to commit, guaranteeing reproducible installs without bloating the repository with thousands of files.

Why It Matters

Composer is the foundation of PHP's modern dependency ecosystem — misusing it creates security vulnerabilities (unpinned versions), deployment fragility (missing lock file), and autoloading problems.

Common Mistakes

  • Not committing composer.lock to version control — different machines install different versions.
  • Running composer update in production — can install breaking changes mid-deploy.
  • Using * or latest version constraints — installs any future version including breaking changes.
  • Including require-dev dependencies in production builds by not using --no-dev flag.

Code Examples

✗ Vulnerable
// composer.json with wildcard versions — unpredictable installs:
{
  "require": {
    "vendor/package": "*",
    "another/lib": "@latest"
  }
}
✓ Fixed
# Install dependencies from composer.lock (reproducible)
$ composer install --no-dev --optimize-autoloader

# Add a package
$ composer require ramsey/uuid

# Require dev dependency (not installed in production)
$ composer require --dev phpunit/phpunit

# Audit for known CVEs
$ composer audit

# Autoload dump — after adding classes manually
$ composer dump-autoload --optimize

# composer.json — key fields
{
  "require": {"php": ">=8.2", "ext-pdo": "*"},
  "autoload": {"psr-4": {"App\\\\": "src/"}},
  "scripts": {
    "test": "phpunit",
    "lint": "phpcs --standard=PSR12 src/"
  }
}

Added 15 Mar 2026
Edited 22 Mar 2026
Views 211
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 1 ping W 0 pings T 0 pings F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 0 pings T 1 ping F 0 pings S
No pings yet today
PetalBot 1
Scrapy 23 Amazonbot 21 PetalBot 19 Ahrefs 13 SEMrush 13 Perplexity 11 Bing 8 Google 6 ChatGPT 5 Unknown AI 5 Brave Search 2 Applebot 2 Meta AI 1 Sogou 1 Twitter/X 1 Baidu 1
crawler 128 crawler_json 3 pre-tracking 1
🧱 FUNDAMENTALS — new to this? Start with the ground floor.
Dependency general A dependency is any external code your project needs to work—a library, package, or module that your code relies on rather than writing from scratch.

Nearly all real-world projects use dependencies. Understanding them lets you leverage existing solutions, manage updates safely, and debug issues when external code causes problems.

💡 Always use a package manager (Composer, npm) to install dependencies—never manually copy library files into your project.

Ask Codex about Dependency →
Package general A package is a bundle of pre-written code that you can download and use in your project instead of writing everything from scratch.

Packages let you build on tested, maintained code instead of reinventing common solutions. Understanding packages is essential because nearly every modern project relies on dozens or hundreds of them.

💡 Before installing any package, check its last update date and weekly downloads—abandoned packages become security liabilities.

Ask Codex about Package →
PHP php A server-side scripting language that generates web pages and APIs — the code runs on the server, and only its output (usually HTML or JSON) reaches the browser.

PHP is often the first server-side language people meet, and understanding its execution model — script starts fresh on every request, no memory between requests — explains most of how the web backend works: sessions, databases, and caching all exist to bridge that per-request amnesia.

💡 Start with PHP 8.x, declare(strict_types=1), and PDO — skip any tutorial that mentions mysql_query().

Ask Codex about PHP →
require php require is a PHP statement that loads and runs another PHP file at that spot in your code. If the file is missing, PHP stops with a fatal error.

Every non-trivial PHP project is split into files, and require is how those files find each other. Modern frameworks hide it behind autoloading, but it's still the underlying mechanism.

💡 Use require_once with __DIR__ for files your app depends on — absolute path, loaded exactly once.

Ask Codex about require →
⚡ DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: Low
⚡ Quick Fix
Always commit composer.lock, run 'composer install' (not update) in CI and production, and run 'composer audit' to check for CVEs
📦 Applies To
PHP 5.3+ web cli queue-worker
🔗 Prerequisites
🔍 Detection Hints
composer.lock not committed; composer update in CI/production; no composer audit step
Auto-detectable: ✓ Yes composer dependabot snyk
⚠ Related Problems
🤖 AI Agent
Confidence: Medium False Positives: Low ✗ Manual fix Fix: Medium Context: File


✓ schema.org compliant