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 init2
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/uuidUpdate one package:
composer update ramsey/uuidUpdate 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