CodeIgniter编写器“ package.json”位置应该在应用程序或根文件夹中? [英] CodeIgniter Composer "package.json" locations shluld be in application or root folder?

查看:38
本文介绍了CodeIgniter编写器“ package.json”位置应该在应用程序或根文件夹中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用代码点火器v3.x,我想添加一些作曲家软件包。



查看 application / config / config。 php 文件,它表示将在应用程序文件夹中加载程序包

  |在application / vendor / autoload.php中打包自动加载程序脚本。 

但是在codeigniter程序包中已经有一个 package.json 在根文件夹上安装软件包。



我怀疑根目录上的 package.json 必须仅保留有关CodeIgniter的信息。但是我不确定。



所以我有三个选择:


  1. application 文件夹中创建一个新的 package.json 并在 application中安装软件包


  2. 通过添加修改根文件夹上的 package.json 新软件包并更改 autoload.php 位置


什么是

解决方案

好吧,如果您看一下Codeigniter文档,您会发现有一个Configuration设置。称为 composer_autoload 。可以在


I working with code igniter v3.x and I would like to add some composer packages.

looking at application/config/config.php file, it says that will load packages inside application folder

| package auto-loader script in application/vendor/autoload.php.

However in the codeigniter package it already has a package.json that installs packages on root folder.

I suspect that the package.json on the root must hold only information about CodeIgniter it self. But I'm not sure.

So I have three options:

  1. Create a new package.json inside the application folder and install packages inside application.

  2. Modify the package.json on the root folder by adding new package and change autoload.php location

What is expected from a CodeIgniter Application?

解决方案

Well, if you take a look at the Codeigniter Documentation you can see there is a Configuration setting called composer_autoload. This information can be found here.

If you set this true, Codeigniter tries to load Composer's autoload.php in the APPLICATION.'vendor' folder. If you take a closer look at the Codeigniter.php file, you'll see that you can define a directory for this setting too.

So in your case you don't have to change the package.json in the root folder because you need one in the application folder, in case you set composer_autoload to true, which i would recommend.

By the way if you try to install a package via composer in your application directory, composer asks you if you want to use the one it found on the root folder - just decline that and press n.

As you can see in the picture below (i just tried to install the mpdf package).

这篇关于CodeIgniter编写器“ package.json”位置应该在应用程序或根文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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