Reputation:
Why Yii2 error composer, see :
I use IDE "NetBeans"
Upvotes: 0
Views: 148
Reputation: 1079
A json file is not meant to be injected with PHP code. If you want to create it dynamically, you can write a PHP tool that generate json text.
Upvotes: 0
Reputation: 2037
@user5717615 composer.json is used by composer. The data contained in composer.json should not change when the package is in use. The package maintainer changes the contents, pushes the package to the origin repo and users then update to that version.
Upvotes: 0
Reputation: 33548
You can't use PHP in JSON. Without quotes JSON will be incorrect, with them it will be interpreted as simple string. If you want composer.json
to be builded dynamically, you need to write some PHP generator class for it that will create new file, put contents there and save it.
But I think it doesn't make sense. Can't remember even one case when it was needed. Maybe for CMS modules.
Upvotes: 2