php Codeigniter + Composer

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32339582/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 22:55:06  来源:igfitidea点击:

Codeigniter + Composer

phpcodeignitercomposer-phpautoload

提问by ?amo

I would like to start learning Codeigniter. But it seems that Codeigniter has not support for installation via Composer. When I search in Google I found this link. It seems that Codeigniter has not support for autoload.php file created by Composer. The documentation describes the only installation via downloading .zip archive. I am not sure if Codeigniter is a good choice now. Is it?

我想开始学习Codeigniter。但似乎 Codeigniter 不支持通过 Composer 安装。当我在 Google 中搜索时,我找到了这个链接。Codeigniter 似乎不支持 Composer 创建的 autoload.php 文件。该文档描述了通过下载 .zip 存档进行的唯一安装。我不确定 Codeigniter 现在是否是一个不错的选择。是吗?

回答by cssBlaster21895

It has composer support in version 3. According to the documentationyou can set in application/config/config.php .

它在版本 3 中支持 composer。根据您可以在 application/config/config.php 中设置的文档

$config['composer_autoload'] = TRUE;  //around 134 line

It will search for composer autoload script inside application/vendor. Place composer.jsoninside application(Codeigniter's application folder, not the root) folder. Then run composer init, and then - composer install.

它会在里面搜索作曲家自动加载脚本application/vendor。放置composer.json在应用程序(Codeigniter 的应用程序文件夹,而不是根)文件夹中。然后运行composer init,然后 - composer install

And if CI fits you, then its right tool for your job:)

如果 CI 适合您,那么它就是适合您工作的正确工具:)

p.s. there is also a composer installer here https://github.com/kenjis/codeigniter-composer-installer

ps 这里还有一个 composer installer https://github.com/kenjis/codeigniter-composer-installer

回答by Yassine Sedrani

use the following code

使用以下代码

composer create-project kenjis/codeigniter-composer-installer codeigniter

Source

来源

回答by Saleeshprakash Salu

According to the documentation you can configure the config.php file inside config folder,

根据文档,您可以在 config 文件夹中配置 config.php 文件,

change the $config['composer_autoload']line to

$config['composer_autoload']行更改为

$config['composer_autoload'] = TRUE; 

or use path

或使用路径

$config['composer_autoload'] = FCPATH . 'vendor/autoload.php'; 

回答by venkatskpi

Tips 1:

提示1:

A Multi-Framework Composer Library Installer

多框架 Composer 库安装程序

http://composer.github.com/installers

http://composer.github.com/installers

Tips 2:

提示2:

composer create-project kenjis/codeigniter-composer-installer codeigniter