user5717615
user5717615

Reputation:

Yii2 error composer

Why Yii2 error composer, see : enter image description here

I use IDE "NetBeans"

Upvotes: 0

Views: 148

Answers (4)

Phiter
Phiter

Reputation: 14982

Put quotes outside <?= and ?> on line 5

Upvotes: 1

Haqqi
Haqqi

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

David J Eddy
David J Eddy

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

arogachev
arogachev

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

Related Questions