protected function registerPackage($vendor, $package, $relPackagePath)
    {
        $this->info('Register package in composer.json.');

        $composerJson = $this->loadComposerJson();

        if (! isset($composerJson['repositories'])) {
            Arr::set($composerJson, 'repositories', []);
        }

        $filtered = array_filter($composerJson['repositories'], function ($repository) use ($relPackagePath) {
            return $repository['type'] === 'path'
                && $repository['url'] === $relPackagePath;
        });

        if (count($filtered) === 0) {
            $this->info('Register composer repository for package.');

            $composerJson['repositories'][] = (object) [
                'type' => 'path',
                'url' => $relPackagePath,
            ];
        } else {
            $this->info('Composer repository for package is already registered.');
        }

        Arr::set($composerJson, "require.$vendor/$package", 'dev-master');

        $this->saveComposerJson($composerJson);

        $this->info('Package was successfully registered in composer.json.');
    }