The composer.json Builder generates the manifest Composer uses to manage a PHP project’s dependencies, autoloading and scripts. Choose Laravel, Symfony or a plain library and the tool emits valid JSON with the right framework packages and dev tooling.
How it works
Composer reads composer.json to resolve packages from Packagist. The require section lists runtime dependencies — for Laravel that means laravel/framework and laravel/tinker plus a PHP constraint; for Symfony, the console and runtime components. The require-dev section holds tools like phpunit, pint or phpstan that are installed only outside production. Version constraints use the caret operator, so ^11.0 accepts any 11.x but blocks 12.0.
The autoload.psr-4 map wires a namespace prefix to a directory so Composer can locate your classes by filename. Laravel projects get the conventional App\, Database\Factories\ and Database\Seeders\ mappings; libraries get a single src/ mapping. The output is produced with JSON.stringify, so it is always valid JSON.
Example
After saving the file, install dependencies:
composer install # writes composer.lock
composer install --no-dev # production: skip require-dev
Tips and notes
Commit composer.lock for applications so deployments install identical versions. Keep minimum-stability at stable with prefer-stable: true unless you deliberately need pre-release packages. The optimize-autoloader and sort-packages config keys speed up class loading and keep your require sections tidy. Run composer validate to confirm the file is well formed before committing.