Refactored
parent
db64917a83
commit
24de082fd5
|
@ -1,16 +1,22 @@
|
|||
# Create Projects
|
||||
|
||||
You can use Composer to create new projects from an existing package. There are several applications for this:
|
||||
You can use Composer to create new projects from an existing package.
|
||||
There are several applications for this:
|
||||
|
||||
1. You can deploy application packages.
|
||||
2. You can check out any package and start developing on patches for example.
|
||||
3. Projects with multiple developers can use this feature to bootstrap the initial application for development.
|
||||
|
||||
To create a new project using composer you can use the "create-project", pass it a package name + version and a directory to create the project in. The directory is not allowed to exist, it will be created during installation.
|
||||
To create a new project using composer you can use the "create-project",
|
||||
pass it a package name + version and a directory to create the project in.
|
||||
The directory is not allowed to exist, it will be created during installation.
|
||||
|
||||
php composer.phar create-project doctrine/orm 2.2.0 /path/to/new-project
|
||||
|
||||
By default the command checks for the packages on packagist.org. To change this behavior you can use the --repository-url parameter and either point it to an HTTP url for your own packagist repository or to a packages.json file.
|
||||
By default the command checks for the packages on packagist.org. To change this behavior
|
||||
you can use the --repository-url parameter and either point it to an HTTP url
|
||||
for your own packagist repository or to a packages.json file.
|
||||
|
||||
If you want to get a development version of the code directly checked out from version control you have to add the --prefer-source parameter.
|
||||
If you want to get a development version of the code directly checked out
|
||||
from version control you have to add the --prefer-source parameter.
|
||||
|
||||
|
|
|
@ -81,11 +81,11 @@ EOT
|
|||
$dm->setPreferSource(true);
|
||||
}
|
||||
|
||||
if ($repositoryUrl === null) {
|
||||
if (null === $repositoryUrl) {
|
||||
$sourceRepo = new ComposerRepository(array('url' => 'http://packagist.org'));
|
||||
} else if (substr($repositoryUrl, -5) === ".json") {
|
||||
} elseif (".json" === substr($repositoryUrl, -5)) {
|
||||
$sourceRepo = new FilesystemRepository($repositoryUrl);
|
||||
} else if (strpos($repositoryUrl, 'http') === 0) {
|
||||
} elseif (0 === strpos($repositoryUrl, 'http')) {
|
||||
$sourceRepo = new ComposerRepository(array('url' => $repositoryUrl));
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid repository url given. Has to be a .json file or an http url.");
|
||||
|
@ -96,7 +96,7 @@ EOT
|
|||
throw new \InvalidArgumentException("Could not find package $packageName with version $version.");
|
||||
}
|
||||
|
||||
if ($directory === null) {
|
||||
if (null === $directory) {
|
||||
$parts = explode("/", $packageName);
|
||||
$directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue