我的 composer.json 的一个存储库现在是空的或私有的 我仍然想使用这个 composer.json 我如何添加新的存储库

Posted

技术标签:

【中文标题】我的 composer.json 的一个存储库现在是空的或私有的 我仍然想使用这个 composer.json 我如何添加新的存储库【英文标题】:One repository my composer.json now empty or private I still wanted to use this composer.json how i add new repository 【发布时间】:2017-09-30 01:24:04 【问题描述】:

这是我的 composer.json


"name": "mountain-code/symfony-sonata-media-admin",
"license": "proprietary",
"type": "project",
"autoload": 
    "psr-4": 
        "": "src/"
    ,
    "classmap": [
        "app/AppKernel.php",
        "app/AppCache.php"
    ]
,

"repositories": [
    
    "type": "vcs",
        "url": "https://github.com/sidz/SonataMediaBundle.git",
        "no-api": true
    
],

"require": 
    "php": ">=5.3.9",
    "symfony/symfony": "2.8.*",
    "doctrine/orm": "^2.4.8",
    "doctrine/doctrine-bundle": "~1.4",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~5.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "incenteev/composer-parameter-handler": "~2.0",
    "sensio/generator-bundle": "~2.3",
    "sonata-project/admin-bundle": "~2.3",
    "sonata-project/doctrine-orm-admin-bundle": "~2.3",
    "sonata-project/user-bundle": "^2.2",
    "doctrine/doctrine-fixtures-bundle": "^2.3",
    "sonata-project/media-bundle": "2.3.x-dev",
    "tilleuls/ckeditor-sonata-media-bundle": "^1.0",
    "egeloen/ckeditor-bundle": "^4.0",
    "knplabs/knp-menu-bundle": "~1.1",
    "payum/payum-bundle": "^2.1",
    "php-http/guzzle6-adapter": "^1.1",
    "payum/paypal-express-checkout-nvp": "^1.3",
    "payum/offline": "^1.3",
    "hwi/oauth-bundle": "^0.5.1"
,
"require-dev": 
    "symfony/phpunit-bridge": "~2.7"
,
"scripts": 
    "post-install-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ],
    "post-update-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ]
,
"config": 
    "bin-dir": "bin",
    "platform": 
        "php": "5.5.9"
    
,
"extra": 
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install": "relative",
    "incenteev-parameters": 
        "file": "app/config/parameters.yml"
    

现在

  "repositories": [
    
    "type": "vcs",
        "url": "https://github.com/sidz/SonataMediaBundle.git",

它是空的 但我仍然想通过添加另一个 adcalendar 存储库来使用这个 composer.json 但是当我要求 adesigns / calendar-bundle 时,不要下载空或私有存储库 (https://github.com/sidz/SonataMediaBundle.git),谢谢

【问题讨论】:

【参考方案1】:

你运气不好。你引用其他人的东西的方式专门解决了他们决定不发布他们的作品供公众消费的决定。您没有分叉他们的 repo 或以任何其他方式将他们的工作存储为备份。现在它消失了。

唯一希望留下的是vendor/sidz/SonataMediaBundle 目录的当前状态以及您在删除之前能够下载的最后一个版本。您可以启动一个新存储库并将此状态提交到其中并使用相同的版本对其进行标记,然后将引用切换到此新存储库。 Composer 仅按包名称工作 - 如果名称没有改变(它在您已经拥有的 composer.json 文件中定义),并且版本没有改变,Composer 认为这个包是相同的,即使源 URL 是不同。

您还可以将您的依赖恢复为仍然维护的原始包:https://packagist.org/packages/sonata-project/media-bundle 我不知道您的代码需要进行多少更改才能使其正常工作,但我强烈建议您这样做走那条路,否则你必须自己维护那个非官方的包。

【讨论】:

幸运的是,我在工作结束时只是错过了通过扩展已有的捆绑包解决的一些小问题,谢谢

以上是关于我的 composer.json 的一个存储库现在是空的或私有的 我仍然想使用这个 composer.json 我如何添加新的存储库的主要内容,如果未能解决你的问题,请参考以下文章

通过 Composer 从私有 Bitbucket 存储库导入包

GIT 发布新版本存储库

如何使用 Composer 从本地 Git 存储库安装标记提交?

使用 Composer 添加包(通过 SVN)

未找到 Webpack 包存储库

Composer包在安装时复制目录