1
0
Fork 0

Updates per @stof

pull/223/head
Beau Simensen 2012-01-18 09:59:04 -08:00
parent d21fca24a6
commit 8507bcf298
1 changed files with 15 additions and 8 deletions

View File

@ -6,7 +6,7 @@ Any runnable code that a Composer package would like to pass along
to a user who installs the package should be listed as a bin. to a user who installs the package should be listed as a bin.
If a package contains other runnable code that is not needed by the If a package contains other runnable code that is not needed by the
user (like build or compile scripts) that code need not be listed user (like build or compile scripts) that code should not be listed
as a bin. as a bin.
@ -16,11 +16,11 @@ It is defined by adding the `bin` key to a project's `composer.json`.
It is specified as an array of files so multiple bins can be added It is specified as an array of files so multiple bins can be added
for any given project. for any given project.
~~~json ```json
{ {
"bin": ["bin/my-script", "bin/my-other-script"] "bin": ["bin/my-script", "bin/my-other-script"]
} }
~~~ ```
## What does defining a bin in composer.json do? ## What does defining a bin in composer.json do?
@ -44,29 +44,36 @@ symlink is created from each dependency's bins to `vendor/bin`.
Say package `my-vendor/project-a` has bins setup like this: Say package `my-vendor/project-a` has bins setup like this:
~~~json ```json
{ {
"name": "my-vendor/project-a", "name": "my-vendor/project-a",
"bin": ["bin/project-a-bin"] "bin": ["bin/project-a-bin"]
} }
~~~ ```
Running `composer install` for this `composer.json` will not do Running `composer install` for this `composer.json` will not do
anything with `bin/project-a-bin`. anything with `bin/project-a-bin`.
Say project `my-vendor/project-b` has requirements setup like this: Say project `my-vendor/project-b` has requirements setup like this:
~~~json ```json
{ {
"name": "my-vendor/project-b", "name": "my-vendor/project-b",
"requires": { "requires": {
"my-vendor/project-a": "*" "my-vendor/project-a": "*"
} }
} }
~~~ ```
Running `composer install` for this `composer.json` will look at Running `composer install` for this `composer.json` will look at
all of project-b's dependencies and install them to `vendor/bin`. all of project-b's dependencies and install them to `vendor/bin`.
In this case, Composer will create a symlink from In this case, Composer will create a symlink from
`vendor/my-vendor/project-a/bin/project-a-bin` to `vendor/bin/project-a-bin`. `vendor/my-vendor/project-a/bin/project-a-bin` to `vendor/bin/project-a-bin`.
## What about Windows and .bat files?
Composer will automatically create `.bat` files for bins installed in a
Windows environment. Package maintainers should not list self managed
`.bat` files as bins.