问题
I would like to test my private composer package on localhost without the need to commit a new tag to perform the test.
My package tree
├── composer.json
├── README.md
└── src
├── Controllers
│
├── Models
├── Providers
│ └── RouteGenericServiceProvider.php
├── Repositories
├── Routes
│ └── generics.php
├── Services
│
└── Transformers
回答1:
As an alternative to what is suggested bey @Matteo, you can use an inline alias and reference a commit hash instead of a tag.
Assume that x.y.z
is the version you have currently installed, and #123abc
is the hash of the commit you would tag once successfully tested (probably HEAD
of whatever the branch is you want to test), then run:
$ composer require "my/package:dev-master#123abc as x.y.z"
For reference, see:
- https://getcomposer.org/doc/articles/aliases.md#require-inline-alias
回答2:
You can use the Path repository type. From the doc:
For instance, if you have the following directory structure in your repository:
- apps \_ my-app \_ composer.json - packages \_ my-package \_ composer.json
Then, to add the package
my/package
as a dependency, in yourapps/my-app/composer.json
file, you can use the following configuration:{ "repositories": [ { "type": "path", "url": "../../packages/my-package" } ], "require": { "my/package": "*" } }
Hope this help
来源:https://stackoverflow.com/questions/45680420/how-can-i-test-install-an-untagged-version-of-a-composer-package