Introduction
composer.json is the manifest of a project or package managed with
Composer, a dependency manager for PHP. The one
at the root of a project defines what the project requires.
Structure
The file is JSON, and Composer publishes a
JSON schema for it. A published library needs name (written as
vendor/project) and description; the other properties are optional.
require and require-dev map package names to version
constraints, autoload says how classes are found, and
repositories, config, scripts and
extra hold further settings.
Not described
Known, not yet covered
- Reference: this page is a summary; the properties and the version constraint syntax are not yet described on this site.
- Viewer: the site has no Composer manifest viewer; a
.jsonfile opens in the general JSON viewer, without Composer meanings.
Also used for
- Browser extension manifest – The JSON manifest of a browser extension: its name, permissions and scripts.
- GeoJSON – Map points, lines and areas with properties, written as JSON.
- Hugging Face model config (config.json) – config.json: a model’s architecture and sizes, read before the weights.
- Hugging Face tokenizer (tokenizer.json) – tokenizer.json: a language model’s vocabulary and tokenising rules.
- JSON Schema – A JSON document that describes and validates other JSON documents.
- JavaScript Object Notation – Text format for objects, arrays, strings, numbers and booleans.
- Lottie animation – Vector animations as JSON, exported from After Effects and played in apps and web pages.
- Visual Studio Code settings – VS Code’s settings.json: dotted setting IDs in JSON with comments.
- jCal: iCalendar in JSON – iCalendar as JSON: events, to-dos and time zones as nested arrays.
- jCard: vCard in JSON – vCard 4.0 contacts as JSON: names, numbers and addresses as arrays.
- npm lockfile (package-lock.json) – The exact dependency tree of a JavaScript project, recorded by npm in JSON.
- npm package manifest (package.json) – A JavaScript package’s name, version, scripts and dependencies, in JSON.
Links
Software
- Composer – dependency manager for PHP that reads the file
Reference
- The composer.json schema – Composer’s documentation of every property