2017-09-25 23 views
0

나는 다음과 같은 composer.json 파일했습니다 : 나는 guzzlehttp/guzzle (예 : 5.3.1 등)의 다른 버전을 사용하는 aeris/guzzle-http-mock package을 강제하고 싶습니다packagist.org에서 호스팅되는 composer.json에서 정의한 필수 버전을 대체하는 방법은 무엇입니까?

{ 
    "require": { 
    "guzzlehttp/guzzle": "^5.3" 
    }, 
    "require-dev": { 
    "aeris/guzzle-http-mock": ">=1.1.5" 
    } 
} 

은, 그러나 composer.json 파일에 호스트에서 요구 사항이 읽는 것을 packagist.org. 이러한 요구 사항을 무시할 수있는 해결 방법이 있습니까?

그래서 대신 :

"guzzlehttp/guzzle": "~5.0.0" 

내가 설정하고 싶습니다 : 단지 내 지역 composer.json 파일을 변경하여 이상적으로

"guzzlehttp/guzzle": "^5.3" 

.

현재이 명령은 충돌 오류를 표시 주어진 패키지를 대체하는 것을 목표로 replace property를 사용하여 해결 방법이

$ composer install --prefer-source -vvv 
Reading ./composer.json 
Loading config file ./composer.json 
... 
Reading ~/.composer/cache/repo/https---packagist.org/provider-aeris$guzzle-http-mock.json from cache 
Resolving dependencies through SAT 
Dependency resolution completed in 0.000 seconds 
Reading ~/.composer/cache/repo/https---packagist.org/provider-guzzlehttp$guzzle.json from cache 
Your requirements could not be resolved to an installable set of packages. 

    Problem 1 
    - Installation request for aeris/guzzle-http-mock >=1.1.5 -> satisfiable by aeris/guzzle-http-mock[1.1.5]. 
    - aeris/guzzle-http-mock 1.1.5 requires guzzlehttp/guzzle ~5.0.0 -> satisfiable by guzzlehttp/guzzle[5.0.0, 5.0.1, 5.0.2, 5.0.3] but these conflict with your requirements or minimum-stability. 

답변

0

, 그래서 다른 패키지가 다운로드되지 않습니다. 예를 들어 :

{ 
    "require": { 
    "aeris/guzzle-http-mock": ">=1.1.5" 
    }, 
    "replace": { 
    "guzzlehttp/guzzle": "~5.0.0" 
    }, 
    "minimum-stability": "dev", 
    "prefer-stable": true 
} 

그러나 올바른 버전은 개별적으로 또는 패키지의 일부로 제공 될 필요가 guzzlehttp/guzzle 의존성을 무시하고이 다운로드되지 않습니다.

"repositories": [ 
    { 
    "type": "vcs", 
    "url": "https://github.com/guzzle/guzzle.git" 
    } 
] 

또 다른 아이디어는 같은 inline aliases 사용하는 것입니다 :

예를 들어, 필요한 저장소를 추가하여 수동으로 복제 할 수

"guzzlehttp/guzzle": "dev-5.3.0 as 5.0.3" 

을했지만 작동하지 않습니다 어쨌든이 방법으로 테스트 한 후 예상대로,하지만 어쩌면 방법이있을 수 있습니다.


관련 GitHub의 스레드 : How to replace the 3rd party dependency?