Merge remote-tracking branch 'origin/master' into tls-config
commit
5d015defb8
@ -0,0 +1,8 @@
|
||||
# Auto-detect text files, ensure they use LF.
|
||||
* text=auto eol=lf
|
||||
|
||||
# These files are always considered text and should use LF.
|
||||
# See core.whitespace @ http://git-scm.com/docs/git-config for whitespace flags.
|
||||
*.php text eol=lf whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 diff=php
|
||||
*.json text eol=lf whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4
|
||||
*.test text eol=lf whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4
|
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
$header = <<<EOF
|
||||
This file is part of Composer.
|
||||
|
||||
(c) Nils Adermann <naderman@naderman.de>
|
||||
Jordi Boggiano <j.boggiano@seld.be>
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
EOF;
|
||||
|
||||
$finder = Symfony\CS\Finder\DefaultFinder::create()
|
||||
->files()
|
||||
->name('*.php')
|
||||
->exclude('Fixtures')
|
||||
->in(__DIR__.'/src')
|
||||
->in(__DIR__.'/tests')
|
||||
;
|
||||
|
||||
return Symfony\CS\Config\Config::create()
|
||||
->setUsingCache(true)
|
||||
->setRiskyAllowed(true)
|
||||
->setRules(array(
|
||||
'@PSR2' => true,
|
||||
'duplicate_semicolon' => true,
|
||||
'extra_empty_lines' => true,
|
||||
'header_comment' => array('header' => $header),
|
||||
'include' => true,
|
||||
'long_array_syntax' => true,
|
||||
'method_separation' => true,
|
||||
'multiline_array_trailing_comma' => true,
|
||||
'namespace_no_leading_whitespace' => true,
|
||||
'no_blank_lines_after_class_opening' => true,
|
||||
'no_empty_lines_after_phpdocs' => true,
|
||||
'object_operator' => true,
|
||||
'operators_spaces' => true,
|
||||
'phpdoc_align' => true,
|
||||
'phpdoc_indent' => true,
|
||||
'phpdoc_no_access' => true,
|
||||
'phpdoc_no_package' => true,
|
||||
'phpdoc_order' => true,
|
||||
'phpdoc_scalar' => true,
|
||||
'phpdoc_trim' => true,
|
||||
'phpdoc_type_to_var' => true,
|
||||
'psr0' => true,
|
||||
'return' => true,
|
||||
'remove_leading_slash_use' => true,
|
||||
'remove_lines_between_uses' => true,
|
||||
'single_array_no_trailing_comma' => true,
|
||||
'single_blank_line_before_namespace' => true,
|
||||
'spaces_cast' => true,
|
||||
'standardize_not_equal' => true,
|
||||
'ternary_spaces' => true,
|
||||
'unused_use' => true,
|
||||
'whitespacy_lines' => true,
|
||||
))
|
||||
->finder($finder)
|
||||
;
|
@ -1,23 +1,42 @@
|
||||
language: php
|
||||
|
||||
sudo: false
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- parallel
|
||||
|
||||
php:
|
||||
- 5.3.3
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- hhvm
|
||||
- nightly
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
|
||||
before_script:
|
||||
- sudo apt-get install parallel
|
||||
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
|
||||
- composer install --prefer-source
|
||||
- bin/composer install --prefer-source
|
||||
- flags=""
|
||||
- if [ `phpenv version-name` == "5.3.3" ]; then flags="--ignore-platform-reqs"; fi
|
||||
- composer install $flags
|
||||
- bin/composer install $flags
|
||||
- git config --global user.name travis-ci
|
||||
- git config --global user.email travis@example.com
|
||||
|
||||
script:
|
||||
- ls -d tests/Composer/Test/* | parallel --gnu --keep-order 'echo "Running {} tests"; ./vendor/bin/phpunit -c tests/complete.phpunit.xml {};'
|
||||
- ls -d tests/Composer/Test/* | parallel --gnu --keep-order 'echo "Running {} tests"; ./vendor/bin/phpunit -c tests/complete.phpunit.xml --colors=always {} || (echo -e "\e[41mFAILED\e[0m {}" && $(exit 1));'
|
||||
|
||||
git:
|
||||
depth: 5
|
||||
|
@ -1,29 +1,49 @@
|
||||
Contributing to Composer
|
||||
========================
|
||||
|
||||
Please note that this project is released with a
|
||||
[Contributor Code of Conduct](http://contributor-covenant.org/version/1/2/0/).
|
||||
By participating in this project you agree to abide by its terms.
|
||||
|
||||
Reporting Issues
|
||||
----------------
|
||||
|
||||
When reporting issues, please try to be as descriptive as possible, and include
|
||||
as much relevant information as you can. A step by step guide on how to
|
||||
reproduce the issue will greatly increase the chances of your issue being
|
||||
resolved in a timely manner.
|
||||
|
||||
For example, if you are experiencing a problem while running one of the
|
||||
commands, please provide full output of said command in very very verbose mode
|
||||
(`-vvv`, e.g. `composer install -vvv`).
|
||||
|
||||
If your issue involves installing, updating or resolving dependencies, the
|
||||
chance of us being able to reproduce your issue will be much higher if you
|
||||
share your `composer.json` with us.
|
||||
|
||||
Installation from Source
|
||||
------------------------
|
||||
|
||||
Prior to contributing to Composer, you must use be able to run the tests.
|
||||
To achieve this, you must use the sources and not the phar file.
|
||||
Prior to contributing to Composer, you must be able to run the test suite.
|
||||
To achieve this, you need to acquire the Composer source code:
|
||||
|
||||
1. Run `git clone https://github.com/composer/composer.git`
|
||||
2. Download the [`composer.phar`](https://getcomposer.org/composer.phar) executable
|
||||
3. Run Composer to get the dependencies: `cd composer && php ../composer.phar install`
|
||||
|
||||
You can now run Composer by executing the `bin/composer` script: `php /path/to/composer/bin/composer`
|
||||
You can run the test suite by executing `vendor/bin/phpunit` when inside the
|
||||
composer directory, and run Composer by executing the `bin/composer`. To test
|
||||
your modified Composer code against another project, run `php
|
||||
/path/to/composer/bin/composer` inside that project's directory.
|
||||
|
||||
Contributing policy
|
||||
-------------------
|
||||
|
||||
All code contributions - including those of people having commit access -
|
||||
must go through a pull request and approved by a core developer before being
|
||||
merged. This is to ensure proper review of all the code.
|
||||
|
||||
Fork the project, create a feature branch, and send us a pull request.
|
||||
|
||||
To ensure a consistent code base, you should make sure the code follows
|
||||
the [Coding Standards](http://symfony.com/doc/current/contributing/code/standards.html)
|
||||
which we borrowed from Symfony.
|
||||
the [PSR-2 Coding Standards](http://www.php-fig.org/psr/psr-2/). You can also
|
||||
run [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) with the
|
||||
configuration file that can be found in the project root directory.
|
||||
|
||||
If you would like to help, take a look at the [list of issues](http://github.com/composer/composer/issues).
|
||||
If you would like to help, take a look at the [list of open issues](https://github.com/composer/composer/issues).
|
||||
|
@ -0,0 +1,35 @@
|
||||
build: false
|
||||
shallow_clone: true
|
||||
platform:
|
||||
- x86
|
||||
- x64
|
||||
clone_folder: c:\projects\composer
|
||||
|
||||
cache:
|
||||
- c:\tools\php -> appveyor.yml
|
||||
|
||||
init:
|
||||
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
|
||||
- SET COMPOSER_NO_INTERACTION=1
|
||||
- SET PHP=1
|
||||
- SET ANSICON=121x90 (121x90)
|
||||
|
||||
install:
|
||||
- IF EXIST c:\tools\php (SET PHP=0)
|
||||
- IF %PHP%==1 cinst -y OpenSSL.Light
|
||||
- IF %PHP%==1 cinst -y php
|
||||
- cd c:\tools\php
|
||||
- IF %PHP%==1 copy php.ini-production php.ini /Y
|
||||
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
|
||||
- IF %PHP%==1 echo extension_dir=ext >> php.ini
|
||||
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
|
||||
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
|
||||
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
|
||||
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
|
||||
- appveyor DownloadFile https://getcomposer.org/composer.phar
|
||||
- cd c:\projects\composer
|
||||
- composer install --prefer-source --no-progress
|
||||
|
||||
test_script:
|
||||
- cd c:\projects\composer
|
||||
- vendor/bin/phpunit --colors=always
|
@ -1,85 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
$identifiers = new SPDXLicenseIdentifiersOnline;
|
||||
$printer = new JsonPrinter;
|
||||
$printer->printStringArray($identifiers->getStrings());
|
||||
|
||||
/**
|
||||
* SPDX Identifier List from the registry.
|
||||
*/
|
||||
class SPDXLicenseIdentifiersOnline
|
||||
{
|
||||
const REGISTRY = 'http://www.spdx.org/licenses/';
|
||||
const EXPRESSION = '//*[@typeof="spdx:License"]/code[@property="spdx:licenseId"]/text()';
|
||||
|
||||
private $identifiers;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getStrings()
|
||||
{
|
||||
if ($this->identifiers) {
|
||||
return $this->identifiers;
|
||||
}
|
||||
$this->identifiers = $this->importNodesFromURL(
|
||||
self::REGISTRY,
|
||||
self::EXPRESSION
|
||||
);
|
||||
|
||||
return $this->identifiers;
|
||||
}
|
||||
|
||||
private function importNodesFromURL($url, $expressionTextNodes)
|
||||
{
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadHTMLFile($url);
|
||||
$xp = new DOMXPath($doc);
|
||||
$codes = $xp->query($expressionTextNodes);
|
||||
if (!$codes) {
|
||||
throw new \Exception(sprintf('XPath query failed: %s', $expressionTextNodes));
|
||||
}
|
||||
if ($codes->length < 20) {
|
||||
throw new \Exception('Obtaining the license table failed, there can not be less than 20 identifiers.');
|
||||
}
|
||||
$identifiers = array();
|
||||
foreach ($codes as $code) {
|
||||
$identifiers[] = $code->nodeValue;
|
||||
}
|
||||
|
||||
return $identifiers;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print an array the way this script needs it.
|
||||
*/
|
||||
class JsonPrinter
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param array $array
|
||||
*/
|
||||
public function printStringArray(array $array)
|
||||
{
|
||||
$lines = array('');
|
||||
$line = &$lines[0];
|
||||
$last = count($array) - 1;
|
||||
foreach ($array as $item => $code) {
|
||||
$code = sprintf('"%s"%s', trim($code), $item === $last ? '' : ', ');
|
||||
$length = strlen($line) + strlen($code) - 1;
|
||||
if ($length > 76) {
|
||||
$line = rtrim($line);
|
||||
unset($line);
|
||||
$lines[] = $code;
|
||||
$line = &$lines[count($lines) - 1];
|
||||
} else {
|
||||
$line .= $code;
|
||||
}
|
||||
}
|
||||
$json = sprintf("[%s]", implode("\n ", $lines));
|
||||
$json = str_replace(array("[\"", "\"]"), array("[\n \"", "\"\n]"), $json);
|
||||
echo $json;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,189 @@
|
||||
# Config
|
||||
|
||||
This chapter will describe the `config` section of the `composer.json`
|
||||
[schema](04-schema.md).
|
||||
|
||||
## process-timeout
|
||||
|
||||
Defaults to `300`. The duration processes like git clones can run before
|
||||
Composer assumes they died out. You may need to make this higher if you have a
|
||||
slow connection or huge vendors.
|
||||
|
||||
## use-include-path
|
||||
|
||||
Defaults to `false`. If `true`, the Composer autoloader will also look for classes
|
||||
in the PHP include path.
|
||||
|
||||
## preferred-install
|
||||
|
||||
Defaults to `auto` and can be any of `source`, `dist` or `auto`. This option
|
||||
allows you to set the install method Composer will prefer to use.
|
||||
|
||||
## store-auths
|
||||
|
||||
What to do after prompting for authentication, one of: `true` (always store),
|
||||
`false` (do not store) and `"prompt"` (ask every time), defaults to `"prompt"`.
|
||||
|
||||
## github-protocols
|
||||
|
||||
Defaults to `["git", "https", "ssh"]`. A list of protocols to use when cloning
|
||||
from github.com, in priority order. You can reconfigure it to for example
|
||||
prioritize the https protocol if you are behind a proxy or have somehow bad
|
||||
performances with the git protocol.
|
||||
|
||||
## github-oauth
|
||||
|
||||
A list of domain names and oauth keys. For example using `{"github.com":
|
||||
"oauthtoken"}` as the value of this option will use `oauthtoken` to access
|
||||
private repositories on github and to circumvent the low IP-based rate limiting
|
||||
of their API. [Read
|
||||
more](articles/troubleshooting.md#api-rate-limit-and-oauth-tokens) on how to get
|
||||
an OAuth token for GitHub.
|
||||
|
||||
## http-basic
|
||||
|
||||
A list of domain names and username/passwords to authenticate against them. For
|
||||
example using `{"example.org": {"username": "alice", "password": "foo"}` as the
|
||||
value of this option will let Composer authenticate against example.org.
|
||||
|
||||
> **Note:** Authentication-related config options like `http-basic` and
|
||||
> `github-oauth` can also be specified inside a `auth.json` file that goes
|
||||
> besides your `composer.json`. That way you can gitignore it and every
|
||||
> developer can place their own credentials in there.
|
||||
|
||||
## platform
|
||||
|
||||
Lets you fake platform packages (PHP and extensions) so that you can emulate a
|
||||
production env or define your target platform in the config. Example: `{"php":
|
||||
"5.4", "ext-something": "4.0"}`.
|
||||
|
||||
## vendor-dir
|
||||
|
||||
Defaults to `vendor`. You can install dependencies into a different directory if
|
||||
you want to. `$HOME` and `~` will be replaced by your home directory's path in
|
||||
vendor-dir and all `*-dir` options below.
|
||||
|
||||
## bin-dir
|
||||
|
||||
Defaults to `vendor/bin`. If a project includes binaries, they will be symlinked
|
||||
into this directory.
|
||||
|
||||
## cache-dir
|
||||
|
||||
Defaults to `$COMPOSER_HOME/cache` on unix systems and
|
||||
`C:\Users\<user>\AppData\Local\Composer` on Windows. Stores all the caches used
|
||||
by Composer. See also [COMPOSER_HOME](03-cli.md#composer-home).
|
||||
|
||||
## cache-files-dir
|
||||
|
||||
Defaults to `$cache-dir/files`. Stores the zip archives of packages.
|
||||
|
||||
## cache-repo-dir
|
||||
|
||||
Defaults to `$cache-dir/repo`. Stores repository metadata for the `composer`
|
||||
type and the VCS repos of type `svn`, `github` and `bitbucket`.
|
||||
|
||||
## cache-vcs-dir
|
||||
|
||||
Defaults to `$cache-dir/vcs`. Stores VCS clones for loading VCS repository
|
||||
metadata for the `git`/`hg` types and to speed up installs.
|
||||
|
||||
## cache-files-ttl
|
||||
|
||||
Defaults to `15552000` (6 months). Composer caches all dist (zip, tar, ..)
|
||||
packages that it downloads. Those are purged after six months of being unused by
|
||||
default. This option allows you to tweak this duration (in seconds) or disable
|
||||
it completely by setting it to 0.
|
||||
|
||||
## cache-files-maxsize
|
||||
|
||||
Defaults to `300MiB`. Composer caches all dist (zip, tar, ..) packages that it
|
||||
downloads. When the garbage collection is periodically ran, this is the maximum
|
||||
size the cache will be able to use. Older (less used) files will be removed
|
||||
first until the cache fits.
|
||||
|
||||
## bin-compat
|
||||
|
||||
Defaults to `auto`. Determines the compatibility of the binaries to be installed.
|
||||
If it is `auto` then Composer only installs .bat proxy files when on Windows. If
|
||||
set to `full` then both .bat files for Windows and scripts for Unix-based
|
||||
operating systems will be installed for each binary. This is mainly useful if you
|
||||
run Composer inside a linux VM but still want the .bat proxies available for use
|
||||
in the Windows host OS.
|
||||
|
||||
## prepend-autoloader
|
||||
|
||||
Defaults to `true`. If `false`, the Composer autoloader will not be prepended to
|
||||
existing autoloaders. This is sometimes required to fix interoperability issues
|
||||
with other autoloaders.
|
||||
|
||||
## autoloader-suffix
|
||||
|
||||
Defaults to `null`. String to be used as a suffix for the generated Composer
|
||||
autoloader. When null a random one will be generated.
|
||||
|
||||
## optimize-autoloader
|
||||
|
||||
Defaults to `false`. If `true`, always optimize when dumping the autoloader.
|
||||
|
||||
## sort-packages
|
||||
|
||||
Defaults to `false`. If `true`, the `require` command keeps packages sorted
|
||||
by name in `composer.json` when adding a new package.
|
||||
|
||||
## classmap-authoritative
|
||||
|
||||
Defaults to `false`. If `true`, the Composer autoloader will only load classes
|
||||
from the classmap. Implies `optimize-autoloader`.
|
||||
|
||||
## github-domains
|
||||
|
||||
Defaults to `["github.com"]`. A list of domains to use in github mode. This is
|
||||
used for GitHub Enterprise setups.
|
||||
|
||||
## github-expose-hostname
|
||||
|
||||
Defaults to `true`. If `false`, the OAuth tokens created to access the
|
||||
github API will have a date instead of the machine hostname.
|
||||
|
||||
## gitlab-domains
|
||||
|
||||
Defaults to `["gitlab.com"]`. A list of domains of GitLab servers.
|
||||
This is used if you use the `gitlab` repository type.
|
||||
|
||||
## notify-on-install
|
||||
|
||||
Defaults to `true`. Composer allows repositories to define a notification URL,
|
||||
so that they get notified whenever a package from that repository is installed.
|
||||
This option allows you to disable that behaviour.
|
||||
|
||||
## discard-changes
|
||||
|
||||
Defaults to `false` and can be any of `true`, `false` or `"stash"`. This option
|
||||
allows you to set the default style of handling dirty updates when in
|
||||
non-interactive mode. `true` will always discard changes in vendors, while
|
||||
`"stash"` will try to stash and reapply. Use this for CI servers or deploy
|
||||
scripts if you tend to have modified vendors.
|
||||
|
||||
## archive-format
|
||||
|
||||
Defaults to `tar`. Composer allows you to add a default archive format when the
|
||||
workflow needs to create a dedicated archiving format.
|
||||
|
||||
## archive-dir
|
||||
|
||||
Defaults to `.`. Composer allows you to add a default archive directory when the
|
||||
workflow needs to create a dedicated archiving format. Or for easier development
|
||||
between modules.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"config": {
|
||||
"archive-dir": "/home/user/.composer/repo"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
← [Repositories](05-repositories.md) | [Community](07-community.md) →
|
@ -0,0 +1,118 @@
|
||||
<!--
|
||||
tagline: Version constraints explained.
|
||||
-->
|
||||
|
||||
# Versions
|
||||
|
||||
## Basic Constraints
|
||||
|
||||
### Exact
|
||||
|
||||
You can specify the exact version of a package. This will tell Composer to
|
||||
install this version and this version only. If other dependencies require
|
||||
a different version, the solver will ultimately fail and abort any install
|
||||
or update procedures.
|
||||
|
||||
Example: `1.0.2`
|
||||
|
||||
### Range
|
||||
|
||||
By using comparison operators you can specify ranges of valid versions. Valid
|
||||
operators are `>`, `>=`, `<`, `<=`, `!=`.
|
||||
|
||||
You can define multiple ranges. Ranges separated by a space (<code> </code>)
|
||||
or comma (`,`) will be treated as a **logical AND**. A double pipe (`||`)
|
||||
will be treated as a **logical OR**. AND has higher precedence than OR.
|
||||
|
||||
> **Note:** Be careful when using unbounded ranges as you might end up
|
||||
> unexpectedly installing versions that break backwards compatibility.
|
||||
> Consider using the [caret](#caret) operator instead for safety.
|
||||
|
||||
Examples:
|
||||
|
||||
* `>=1.0`
|
||||
* `>=1.0 <2.0`
|
||||
* `>=1.0 <1.1 || >=1.2`
|
||||
|
||||
### Range (Hyphen)
|
||||
|
||||
Inclusive set of versions. Partial versions on the right include are completed
|
||||
with a wildcard. For example `1.0 - 2.0` is equivalent to `>=1.0.0 <2.1` as the
|
||||
`2.0` becomes `2.0.*`. On the other hand `1.0.0 - 2.1.0` is equivalent to
|
||||
`>=1.0.0 <=2.1.0`.
|
||||
|
||||
Example: `1.0 - 2.0`
|
||||
|
||||
### Wildcard
|
||||
|
||||
You can specify a pattern with a `*` wildcard. `1.0.*` is the equivalent of
|
||||
`>=1.0 <1.1`.
|
||||
|
||||
Example: `1.0.*`
|
||||
|
||||
## Next Significant Release Operators
|
||||
|
||||
### Tilde
|
||||
|
||||
The `~` operator is best explained by example: `~1.2` is equivalent to
|
||||
`>=1.2 <2.0.0`, while `~1.2.3` is equivalent to `>=1.2.3 <1.3.0`. As you can see
|
||||
it is mostly useful for projects respecting [semantic
|
||||
versioning](http://semver.org/). A common usage would be to mark the minimum
|
||||
minor version you depend on, like `~1.2` (which allows anything up to, but not
|
||||
including, 2.0). Since in theory there should be no backwards compatibility
|
||||
breaks until 2.0, that works well. Another way of looking at it is that using
|
||||
`~` specifies a minimum version, but allows the last digit specified to go up.
|
||||
|
||||
Example: `~1.2`
|
||||
|
||||
> **Note:** Though `2.0-beta.1` is strictly before `2.0`, a version constraint
|
||||
> like `~1.2` would not install it. As said above `~1.2` only means the `.2`
|
||||
> can change but the `1.` part is fixed.
|
||||
|
||||
> **Note:** The `~` operator has an exception on its behavior for the major
|
||||
> release number. This means for example that `~1` is the same as `~1.0` as
|
||||
> it will not allow the major number to increase trying to keep backwards
|
||||
> compatibility.
|
||||
|
||||
### Caret
|
||||
|
||||
The `^` operator behaves very similarly but it sticks closer to semantic
|
||||
versioning, and will always allow non-breaking updates. For example `^1.2.3`
|
||||
is equivalent to `>=1.2.3 <2.0.0` as none of the releases until 2.0 should
|
||||
break backwards compatibility. For pre-1.0 versions it also acts with safety
|
||||
in mind and treats `^0.3` as `>=0.3.0 <0.4.0`.
|
||||
|
||||
This is the recommended operator for maximum interoperability when writing
|
||||
library code.
|
||||
|
||||
Example: `^1.2.3`
|
||||
|
||||
## Stability
|
||||
|
||||
If you are using a constraint that does not explicitly define a stability,
|
||||
Composer will default internally to `-dev` or `-stable`, depending on the
|
||||
operator(s) used. This happens transparently.
|
||||
|
||||
If you wish to explicitly consider only the stable release in the comparison,
|
||||
add the suffix `-stable`.
|
||||
|
||||
Examples:
|
||||
|
||||
Constraint | Internally
|
||||
------------------- | ------------------------
|
||||
`1.2.3` | `=1.2.3.0-stable`
|
||||
`>1.2` | `>1.2.0.0-stable`
|
||||
`>=1.2` | `>=1.2.0.0-dev`
|
||||
`>=1.2-stable` | `>=1.2.0.0-stable`
|
||||
`<1.3` | `<1.3.0.0-dev`
|
||||
`<=1.3` | `<=1.3.0.0-stable`
|
||||
`1 - 2` | `>=1.0.0.0-dev <3.0.0.0-dev`
|
||||
`~1.3` | `>=1.3.0.0-dev <2.0.0.0-dev`
|
||||
`1.4.*` | `>=1.4.0.0-dev <1.5.0.0-dev`
|
||||
|
||||
## Test version constraints
|
||||
|
||||
You can test version constraints using [semver.mwl.be](http://semver.mwl.be).
|
||||
Fill in a package name and it will autofill the default version constraint
|
||||
which Composer would add to your `composer.json` file. You can adjust the
|
||||
version constraint and the tool will highlight all releases that match.
|
@ -1,59 +0,0 @@
|
||||
[
|
||||
"Glide", "Abstyles", "AFL-1.1", "AFL-1.2", "AFL-2.0", "AFL-2.1", "AFL-3.0",
|
||||
"AMPAS", "APL-1.0", "Adobe-Glyph", "APAFML", "Adobe-2006", "AGPL-1.0",
|
||||
"Afmparse", "Aladdin", "ADSL", "AMDPLPA", "ANTLR-PD", "Apache-1.0",
|
||||
"Apache-1.1", "Apache-2.0", "AML", "APSL-1.0", "APSL-1.1", "APSL-1.2",
|
||||
"APSL-2.0", "Artistic-1.0", "Artistic-1.0-Perl", "Artistic-1.0-cl8",
|
||||
"Artistic-2.0", "AAL", "Bahyph", "Barr", "Beerware", "BitTorrent-1.0",
|
||||
"BitTorrent-1.1", "BSL-1.0", "Borceux", "BSD-2-Clause",
|
||||
"BSD-2-Clause-FreeBSD", "BSD-2-Clause-NetBSD", "BSD-3-Clause",
|
||||
"BSD-3-Clause-Clear", "BSD-4-Clause", "BSD-Protection",
|
||||
"BSD-3-Clause-Attribution", "BSD-4-Clause-UC", "bzip2-1.0.5", "bzip2-1.0.6",
|
||||
"Caldera", "CECILL-1.0", "CECILL-1.1", "CECILL-2.0", "CECILL-B", "CECILL-C",
|
||||
"ClArtistic", "MIT-CMU", "CNRI-Python", "CNRI-Python-GPL-Compatible",
|
||||
"CPOL-1.02", "CDDL-1.0", "CDDL-1.1", "CPAL-1.0", "CPL-1.0", "CATOSL-1.1",
|
||||
"Condor-1.1", "CC-BY-1.0", "CC-BY-2.0", "CC-BY-2.5", "CC-BY-3.0",
|
||||
"CC-BY-4.0", "CC-BY-ND-1.0", "CC-BY-ND-2.0", "CC-BY-ND-2.5", "CC-BY-ND-3.0",
|
||||
"CC-BY-ND-4.0", "CC-BY-NC-1.0", "CC-BY-NC-2.0", "CC-BY-NC-2.5",
|
||||
"CC-BY-NC-3.0", "CC-BY-NC-4.0", "CC-BY-NC-ND-1.0", "CC-BY-NC-ND-2.0",
|
||||
"CC-BY-NC-ND-2.5", "CC-BY-NC-ND-3.0", "CC-BY-NC-ND-4.0", "CC-BY-NC-SA-1.0",
|
||||
"CC-BY-NC-SA-2.0", "CC-BY-NC-SA-2.5", "CC-BY-NC-SA-3.0", "CC-BY-NC-SA-4.0",
|
||||
"CC-BY-SA-1.0", "CC-BY-SA-2.0", "CC-BY-SA-2.5", "CC-BY-SA-3.0",
|
||||
"CC-BY-SA-4.0", "CC0-1.0", "Crossword", "CUA-OPL-1.0", "Cube", "D-FSL-1.0",
|
||||
"diffmark", "WTFPL", "DOC", "Dotseqn", "DSDP", "dvipdfm", "EPL-1.0",
|
||||
"eCos-2.0", "ECL-1.0", "ECL-2.0", "eGenix", "EFL-1.0", "EFL-2.0",
|
||||
"MIT-advertising", "MIT-enna", "Entessa", "ErlPL-1.1", "EUDatagrid",
|
||||
"EUPL-1.0", "EUPL-1.1", "Eurosym", "Fair", "MIT-feh", "Frameworx-1.0",
|
||||
"FTL", "FSFUL", "FSFULLR", "Giftware", "GL2PS", "Glulxe", "AGPL-3.0",
|
||||
"GFDL-1.1", "GFDL-1.2", "GFDL-1.3", "GPL-1.0", "GPL-1.0+", "GPL-2.0",
|
||||
"GPL-2.0+", "GPL-2.0-with-autoconf-exception",
|
||||
"GPL-2.0-with-bison-exception", "GPL-2.0-with-classpath-exception",
|
||||
"GPL-2.0-with-font-exception", "GPL-2.0-with-GCC-exception", "GPL-3.0",
|
||||
"GPL-3.0+", "GPL-3.0-with-autoconf-exception", "GPL-3.0-with-GCC-exception",
|
||||
"LGPL-2.1", "LGPL-2.1+", "LGPL-3.0", "LGPL-3.0+", "LGPL-2.0", "LGPL-2.0+",
|
||||
"gnuplot", "gSOAP-1.3b", "HaskellReport", "HPND", "IBM-pibs", "IPL-1.0",
|
||||
"ImageMagick", "iMatix", "Imlib2", "IJG", "Intel-ACPI", "Intel", "IPA",
|
||||
"ISC", "JasPer-2.0", "JSON", "LPPL-1.3a", "LPPL-1.0", "LPPL-1.1",
|
||||
"LPPL-1.2", "LPPL-1.3c", "Latex2e", "BSD-3-Clause-LBNL", "Leptonica",
|
||||
"Libpng", "libtiff", "LPL-1.02", "LPL-1.0", "MakeIndex", "MTLL", "MS-PL",
|
||||
"MS-RL", "MirOS", "MITNFA", "MIT", "Motosoto", "MPL-1.0", "MPL-1.1",
|
||||
"MPL-2.0", "MPL-2.0-no-copyleft-exception", "mpich2", "Multics", "Mup",
|
||||
"NASA-1.3", "Naumen", "NBPL-1.0", "NetCDF", "NGPL", "NOSL", "NPL-1.0",
|
||||
"NPL-1.1", "Newsletr", "NLPL", "Nokia", "NPOSL-3.0", "Noweb", "NRL", "NTP",
|
||||
"Nunit", "OCLC-2.0", "ODbL-1.0", "PDDL-1.0", "OGTSL", "OLDAP-2.2.2",
|
||||
"OLDAP-1.1", "OLDAP-1.2", "OLDAP-1.3", "OLDAP-1.4", "OLDAP-2.0",
|
||||
"OLDAP-2.0.1", "OLDAP-2.1", "OLDAP-2.2", "OLDAP-2.2.1", "OLDAP-2.3",
|
||||
"OLDAP-2.4", "OLDAP-2.5", "OLDAP-2.6", "OLDAP-2.7", "OML", "OPL-1.0",
|
||||
"OSL-1.0", "OSL-1.1", "OSL-2.0", "OSL-2.1", "OSL-3.0", "OLDAP-2.8",
|
||||
"OpenSSL", "PHP-3.0", "PHP-3.01", "Plexus", "PostgreSQL", "psfrag",
|
||||
"psutils", "Python-2.0", "QPL-1.0", "Qhull", "Rdisc", "RPSL-1.0", "RPL-1.1",
|
||||
"RPL-1.5", "RHeCos-1.1", "RSCPL", "Ruby", "SAX-PD", "Saxpath", "SCEA",
|
||||
"SWL", "SGI-B-1.0", "SGI-B-1.1", "SGI-B-2.0", "OFL-1.0", "OFL-1.1",
|
||||
"SimPL-2.0", "Sleepycat", "SNIA", "SMLNJ", "StandardML-NJ",
|
||||
"SugarCRM-1.1.3", "SISSL", "SISSL-1.2", "SPL-1.0", "Watcom-1.0", "TCL",
|
||||
"Unlicense", "TMate", "TORQUE-1.1", "TOSL", "Unicode-TOU", "NCSA", "Vim",
|
||||
"VOSTROM", "VSL-1.0", "W3C", "Wsuipa", "WXwindows", "Xnet", "X11", "Xerox",
|
||||
"XFree86-1.1", "xinetd", "xpp", "XSkat", "YPL-1.0", "YPL-1.1", "Zed",
|
||||
"Zend-2.0", "Zimbra-1.3", "Zlib", "zlib-acknowledgement", "ZPL-1.1",
|
||||
"ZPL-2.0", "ZPL-2.1"
|
||||
]
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Command\Helper;
|
||||
|
||||
use Symfony\Component\Console\Helper\DialogHelper as BaseDialogHelper;
|
||||
|
||||
class DialogHelper extends BaseDialogHelper
|
||||
{
|
||||
/**
|
||||
* Build text for asking a question. For example:
|
||||
*
|
||||
* "Do you want to continue [yes]:"
|
||||
*
|
||||
* @param string $question The question you want to ask
|
||||
* @param mixed $default Default value to add to message, if false no default will be shown
|
||||
* @param string $sep Separation char for between message and user input
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuestion($question, $default = null, $sep = ':')
|
||||
{
|
||||
return $default !== null ?
|
||||
sprintf('<info>%s</info> [<comment>%s</comment>]%s ', $question, $default, $sep) :
|
||||
sprintf('<info>%s</info>%s ', $question, $sep);
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class SuggestsCommand extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('suggests')
|
||||
->setDescription('Show package suggestions')
|
||||
->setDefinition(array(
|
||||
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
|
||||
new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
|
||||
))
|
||||
->setHelp(<<<EOT
|
||||
|
||||
The <info>%command.name%</info> command shows suggested packages.
|
||||
|
||||
With <info>-v</info> you also see which package suggested it and why.
|
||||
|
||||
EOT
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$lock = $this->getComposer()->getLocker()->getLockData();
|
||||
|
||||
if (empty($lock)) {
|
||||
throw new \RuntimeException('Lockfile seems to be empty?');
|
||||
}
|
||||
|
||||
$packages = $lock['packages'];
|
||||
|
||||
if (!$input->getOption('no-dev')) {
|
||||
$packages += $lock['packages-dev'];
|
||||
}
|
||||
|
||||
$filter = $input->getArgument('packages');
|
||||
|
||||
foreach ($packages as $package) {
|
||||
if (empty($package['suggest'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($filter) && !in_array($package['name'], $filter)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->printSuggestions($packages, $package['name'], $package['suggest']);
|
||||
}
|
||||
}
|
||||
|
||||
protected function printSuggestions($installed, $source, $suggestions)
|
||||
{
|
||||
foreach ($suggestions as $suggestion => $reason) {
|
||||
foreach ($installed as $package) {
|
||||
if ($package['name'] === $suggestion) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($reason)) {
|
||||
$reason = '*';
|
||||
}
|
||||
|
||||
$this->printSuggestion($source, $suggestion, $reason);
|
||||
}
|
||||
}
|
||||
|
||||
protected function printSuggestion($package, $suggestion, $reason)
|
||||
{
|
||||
$io = $this->getIO();
|
||||
|
||||
if ($io->isVerbose()) {
|
||||
$io->write(sprintf('<comment>%s</comment> suggests <info>%s</info>: %s', $package, $suggestion, $reason));
|
||||
} else {
|
||||
$io->write(sprintf('<info>%s</info>', $suggestion));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\DependencyResolver;
|
||||
|
||||
/**
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
*/
|
||||
class DebugSolver extends Solver
|
||||
{
|
||||
protected function printDecisionMap()
|
||||
{
|
||||
echo "\nDecisionMap: \n";
|
||||
foreach ($this->decisionMap as $packageId => $level) {
|
||||
if ($packageId === 0) {
|
||||
continue;
|
||||
}
|
||||
if ($level > 0) {
|
||||
echo ' +' . $this->pool->packageById($packageId)."\n";
|
||||
} elseif ($level < 0) {
|
||||
echo ' -' . $this->pool->packageById($packageId)."\n";
|
||||
} else {
|
||||
echo ' ?' . $this->pool->packageById($packageId)."\n";
|
||||
}
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
protected function printDecisionQueue()
|
||||
{
|
||||
echo "DecisionQueue: \n";
|
||||
foreach ($this->decisionQueue as $i => $literal) {
|
||||
echo ' ' . $this->pool->literalToString($literal) . ' ' . $this->decisionQueueWhy[$i]." level ".$this->decisionMap[abs($literal)]."\n";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
protected function printWatches()
|
||||
{
|
||||
echo "\nWatches:\n";
|
||||
foreach ($this->watches as $literalId => $watch) {
|
||||
echo ' '.$this->literalFromId($literalId)."\n";
|
||||
$queue = array(array(' ', $watch));
|
||||
|
||||
while (!empty($queue)) {
|
||||
list($indent, $watch) = array_pop($queue);
|
||||
|
||||
echo $indent.$watch;
|
||||
|
||||
if ($watch) {
|
||||
echo ' [id='.$watch->getId().',watch1='.$this->literalFromId($watch->watch1).',watch2='.$this->literalFromId($watch->watch2)."]";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
if ($watch && ($watch->next1 == $watch || $watch->next2 == $watch)) {
|
||||
if ($watch->next1 == $watch) {
|
||||
echo $indent." 1 *RECURSION*";
|
||||
}
|
||||
if ($watch->next2 == $watch) {
|
||||
echo $indent." 2 *RECURSION*";
|
||||
}
|
||||
} elseif ($watch && ($watch->next1 || $watch->next2)) {
|
||||
$indent = str_replace(array('1', '2'), ' ', $indent);
|
||||
|
||||
array_push($queue, array($indent.' 2 ', $watch->next2));
|
||||
array_push($queue, array($indent.' 1 ', $watch->next1));
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
use Symfony\Component\Filesystem\Exception\IOException;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
/**
|
||||
* Download a package from a local path.
|
||||
*
|
||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||
* @author Johann Reinke <johann.reinke@gmail.com>
|
||||
*/
|
||||
class PathDownloader extends FileDownloader
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function download(PackageInterface $package, $path)
|
||||
{
|
||||
$fileSystem = new Filesystem();
|
||||
$this->filesystem->removeDirectory($path);
|
||||
|
||||
$this->io->writeError(sprintf(
|
||||
' - Installing <info>%s</info> (<comment>%s</comment>)',
|
||||
$package->getName(),
|
||||
$package->getFullPrettyVersion()
|
||||
));
|
||||
|
||||
$url = $package->getDistUrl();
|
||||
$realUrl = realpath($url);
|
||||
if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
|
||||
throw new \RuntimeException(sprintf(
|
||||
'Path "%s" is not found',
|
||||
$url
|
||||
));
|
||||
}
|
||||
|
||||
try {
|
||||
$shortestPath = $this->filesystem->findShortestPath($path, $realUrl);
|
||||
$fileSystem->symlink($shortestPath, $path);
|
||||
$this->io->writeError(sprintf(' Symlinked from %s', $url));
|
||||
} catch (IOException $e) {
|
||||
$fileSystem->mirror($realUrl, $path);
|
||||
$this->io->writeError(sprintf(' Mirrored from %s', $url));
|
||||
}
|
||||
|
||||
$this->io->writeError('');
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Config;
|
||||
use Composer\Cache;
|
||||
use Composer\EventDispatcher\EventDispatcher;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\IO\IOInterface;
|
||||
|
||||
/**
|
||||
* Xz archive downloader.
|
||||
*
|
||||
* @author Pavel Puchkin <i@neoascetic.me>
|
||||
* @author Pierre Rudloff <contact@rudloff.pro>
|
||||
*/
|
||||
class XzDownloader extends ArchiveDownloader
|
||||
{
|
||||
protected $process;
|
||||
|
||||
public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null)
|
||||
{
|
||||
$this->process = $process ?: new ProcessExecutor($io);
|
||||
|
||||
parent::__construct($io, $config, $eventDispatcher, $cache);
|
||||
}
|
||||
|
||||
protected function extract($file, $path)
|
||||
{
|
||||
$command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
|
||||
|
||||
if (0 === $this->process->execute($command, $ignoredOutput)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
|
||||
|
||||
throw new \RuntimeException($processError);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getFileName(PackageInterface $package, $path)
|
||||
{
|
||||
return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue