Composer不会创建到bin脚本的符号链接

时间:2015-12-14 12:57:00

标签: composer-php

我有作曲家生成符号链接的问题。 我有 ./ bin / my-script 中的脚本,代码如下:

#!/usr/bin/php
<?php echo 'Hello World!'; ?>

我已将config添加到包composer.json(不在主项目中)

"bin": ["bin/my-script"]

在主项目中更新作曲家时,我的包安装正常。 但是,作曲家不会在 ./ vendor / bin

中创建指向我的bin脚本的符号链接

我做错了什么?

2 个答案:

答案 0 :(得分:0)

Did you checked this link https://getcomposer.org/doc/articles/vendor-binaries.md

I think your problem related with following subject :

What happens when Composer is run on a composer.json that defines vendor binaries?#

For the binaries that a package defines directly, nothing happens.

What happens when Composer is run on a composer.json that has dependencies with vendor binaries listed?#

Composer looks for the binaries defined in all of the dependencies. A symlink is created from each dependency's binaries to vendor/bin.

答案 1 :(得分:0)

好的,我发现了问题。

当我从本地存储库取代而不是作曲家包

我必须将以下行添加到主项目中的存储库设置中。

"repositories": [
    {
        "type": "package",
        "package": {
            "name": "200mph/m-commander",
            "version": "dev-master",
            "source": {
                "url": "/home/wojtek/m-commander",
                "type": "git",
                "reference": "develop"
            },
            "bin": ["bin/m-commander"],
            "autoload": {
                "psr-4" : {
                    "mcommander\\" : "src/",
                    "examples\\mcommander\\" : "examples/"
                }
            }
        }
    }
]