seworqs / composer-editor
A high-level Composer JSON editor for PHP, offering enum-driven configuration, strict typing, and intuitive syntax for working with composer.json files.
1.0.0
2025-04-14 07:08 UTC
Requires
- php: ^8.1
- adbario/php-dot-notation: ^3.3
- seworqs/commons-string: ^1.0
- seworqs/json-editor: ^1.0
Requires (Dev)
- phpunit/phpunit: ^11
README
A high-level Composer JSON editor for PHP, offering enum-driven configuration, strict typing, and intuitive syntax for working with composer.json files.
Installation
Install via Composer.
$> composer require seworqs/composer-editor
Usage
use Seworqs\Composer\Enum\EnumComposerPackageType; use Seworqs\Composer\ComposerEditor; $composer = ComposerEditor::createNew('path/to/composer.json'); $composer->addProjectName('vendor/some-project') ->addDescription('Some nice project!') ->addType(EnumComposerPackageType::LIBRARY) ... ->save(); $projectName = $composer->getProjectName(); // Get array of all scripts. $scripts = $composer->getScripts(); // Get specific script $script = $composer->getScript('cleanup');
Features
- Create and edit new Composer JSON file
- Edit existing Composer JSON file
- Use easy dot notation to get to your keys
- Bump version with seworqs/semver integration
See our examples
Classes and namespaces
Namespace | Class | Description |
---|---|---|
Seworqs\ComposerEditor | ComposerEditor | Nice Composer editor |
License
Apache-2.0, see LICENSE
About SEworqs
Seworqs builds clean, reusable modules for PHP and Mendix developers.
Learn more at github.com/seworqs