当Symfony 2.1中没有用composer管理供应商时,在哪里注册自动加载? [英] Where to register autoload when the vendor is not managed with composer in Symfony 2.1?

查看:316
本文介绍了当Symfony 2.1中没有用composer管理供应商时,在哪里注册自动加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用symfony 2.1,我想向供应商添加库。库不存在于packagist中。我不能管理它与作曲家。当我通过作曲家安装软件包或其他供应商时,它会为我管理自动加载。

I'm using symfony 2.1 and I want to add a library to vendors. The library do not exists in packagist. I can't manage it with composer. When I install bundles or others vendors through composer, it manage autoload for me. But where to register autoload when the vendor is not managed with composer?

推荐答案

您可以向compager添加不在packagist中的库。
您必须将它们添加到 composer.json 文件的 repositories 数组中。

You can add libraries to composer that are not in packagist. You must add them in the repositories array of your composer.json file.

这里是如何加载一个github仓库有一个composer.json文件,即使它不是在packagist(例如你会做一个fork你修复一个仓库): http://getcomposer.org/doc/02-libraries.md#publishing-to-a-vcs

Here's how to load a github repository that has a composer.json file, even though it's not on packagist (for example a fork you would have done to fix a repository) : http://getcomposer.org/doc/02-libraries.md#publishing-to-a-vcs

下面是如何加载git / svn存储库上的库或zip文件:http://getcomposer.org/doc/05-repositories.md#types

And here's how to load a library that's on a git/svn repository, or a zip file : http://getcomposer.org/doc/05-repositories.md#types

示例使用各种可能性:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "http://github.com/igorw/monolog"
    },
    {
      "type": "package",
      "package": {
        "name": "smarty/smarty",
        "version": "3.1.7",
        "dist": {
          "url": "http://www.smarty.net/files/Smarty-3.1.7.zip",
          "type": "zip"
        },
        "source": {
          "url": "http://smarty-php.googlecode.com/svn/",
          "type": "svn",
          "reference": "tags/Smarty_3_1_7/distribution/"
        },
        "autoload": {
          "classmap": [
            "libs/"
          ]
        }
      }
    }
  ],
  "require": {
    "monolog/monolog": "dev-bugfix",
    "smarty/smarty": "3.1.*"
  }
}

这篇关于当Symfony 2.1中没有用composer管理供应商时,在哪里注册自动加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆