About this tool
Build a valid composer.json with PSR-4 autoload, require and require-dev constraints, scripts, config and platform requirements.
This generator writes a composer.json — the manifest Composer reads to resolve PHP dependencies, register autoloading and expose scripts. It validates the package name against the vendor/package pattern in the Composer schema, checks every version constraint, and enforces the PSR-4 rule that a namespace prefix must end with a backslash. Aimed at anyone starting a PHP library or application and wanting the manifest right before the first composer install.
Open Composer JSON Generator on AltFTool — it loads instantly in your browser.
Paste or upload your source content.
Choose the target format or conversion mode.
Copy or download the converted result.
Keys are written in the order Composer itself produces, so diffs stay small.
Rejects malformed constraints before composer update fails on them.
Package names, namespaces and author details stay in your browser.
require lists packages your code needs at runtime and is installed for everyone, including people who depend on your package. require-dev lists tools only the maintainers need — test runners, linters, static analysers — and Composer skips them when you run composer install --no-dev, which is what you do on a production deploy.
It allows any version from 8.2.0 up to but not including 9.0.0, because the caret pins the leftmost non-zero digit. For a 0.x package the rule is stricter: ^0.3 allows 0.3.x only, since in semantic versioning a 0.x minor bump may break the API.
Because the value is a namespace prefix, not a class name, and Composer strips exactly that prefix before mapping the rest of the class name to a file path. Writing "Acme\Widget": "src/" without the trailing backslash makes Composer emit a warning and the autoloader will not find your classes.
Commit it for applications and projects so every environment installs identical versions. For libraries the lock file is ignored by consumers, so many maintainers leave it out of the repository; either way run composer validate in CI to catch a lock file that has drifted from composer.json.