du248227 2014-11-20 11:47
浏览 68

在Composer中为导入的第三方包添加名称空间

I am importing a third-party package into my project using composer.

The composer.json of the package autoloads its classes using "classmap":

{
  ...
  "name"=>"vendor/project",
  ...
  "require": {
    "php": ">=5.2.0"
  },
  "type": "library",
  "include-path":["src/"],
  "classmap": [
    "src/path/to/lib1",
    "src/path/to/lib2"
  ]
  ...
}

My project composer.json pulls the package in using "require".

{
  ...
  "require": {
    "vendor/project": "m.n.*",
  }
  ...
}

I'd like to add a namespace that can prefix all the classes of that package when I use it in my project, can I do this in composer?

I am aware I can use autoload at the level of my project, but presumably these classes don't need loading again and where do I point it?

  • 写回答

0条回答 默认 最新

    报告相同问题?