githubEdit

composer.json

Understand and configure composer.json so Discloud can install your PHP dependencies automatically.

πŸ—‚ What is composer.json?

composer.json declares your project's metadata, required packages, autoload rules, and optional scripts. When present at the root of the archive you upload, Discloud installs the dependencies defined inside using Composer.


πŸ›  Creating composer.json

1

Generate interactively:

composer init
2

Or create a minimal file manually:

{
  "name": "example/app",
  "type": "project",
  "require": {
    "guzzlehttp/guzzle": "^7.9"
  },
  "autoload": {
    "psr-4": { "App\\\\": "src/" }
  }
}
3

Then install:

composer install

πŸ“¦ Adding / Updating Dependencies

Install new package:

composer require ramsey/uuid

Update one package:

composer update ramsey/uuid

Update all (may change versions broadly):

composer update

πŸ“„ Lock File (composer.lock)

Commit composer.lock so deployments reproduce the exact dependency versions. If absent, latest matching versions are resolved during install.


🧰 Common Commands Reference

Last updated