dongmi4720
dongmi4720
2015-05-13 01:25
浏览 80

使用Composer安装我自己的应用程序

Is there a way to get composer to download my application into my root folder?

I'd like users to be able to run the following in their docroot:

composer require name/package

And have that download all my application files to the docroot, then install dependencies into vendor via the composer.json file.

composer install

Is this even possible?

I thought I could use the repositories directive in the composer.json but it still installs all my files into vendor

My composer.json looks like so:

{
    "name": "username/package",
    "description": "My App Description",
    "require": {
        "php": ">=5.5.0",
        "raven/raven": "0.11.0",
        "filp/whoops": "~1.0",
        "robmorgan/phinx": "*",
        "swiftmailer/swiftmailer": "@stable"
    },
    "minimum-stability": "dev"
}

Any way to add my package and have it install where I want?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douliang1369
    douliang1369 2015-05-13 02:45
    已采纳

    Ok I found the answer: create-project

    composer create-project name/package public_html --stability="dev"
    

    This will create the public_html directory and download all the dependencies.

    Perfect.

    点赞 评论
  • doumicheng6732
    doumicheng6732 2015-05-13 02:03

    Move your composer.json at the root of your package. Then, simply create a git repository ensuring the composer.json is in the root, and push it to a service such as github.

    Visit: https://packagist.org/packages/submit (sign in required) and paste your git url in the Repository URL field.

    Please ensure that you follow the Composer naming conventions

    点赞 评论

相关推荐