"file://$PLUGIN_SOURCE", 'type' => 'zip', ); $rootComposerJson = json_decode($json, true); check_json_error($json); $rootComposerJson['require']['yiisoft/yii2-composer'] = 'dev-test as 2.0.x-dev'; $rootComposerJson['repositories'][] = array( 'type' => 'package', 'package' => $packageComposerJson, ); file_put_contents($targetFile, json_encode($rootComposerJson, JSON_PRETTY_PRINT)); function check_json_error($json) { if (json_last_error() !== JSON_ERROR_NONE) { echo "Failed to parse JSON: " . json_last_error_msg() . "\n"; echo "$json\n"; exit(1); } }