CodeIgniter Composer quot;package.jsonquot; locations shluld be in application or root folder?(CodeIgniter Composer “package.json位置应该在应用程序或根文件夹中?)
问题描述
我正在使用代码点火器 v3.x,我想添加一些作曲家包.
查看 application/config/config.php 文件,它说将在应用程序文件夹中加载包
<代码>|在 application/vendor/autoload.php 中打包自动加载脚本.
然而,在 codeigniter 包中,它已经有一个 package.json 用于在根文件夹中安装包.
我怀疑根目录上的 package.json 必须只包含有关 CodeIgniter 自身的信息.但我不确定.
所以我有三个选择:
在
application文件夹中创建一个新的package.json并在application中安装包.通过添加新包来修改根文件夹上的
package.json并更改autoload.php位置
CodeIgniter 应用程序有什么期望?
好吧,如果您查看 Codeigniter 文档,您会发现有一个名为 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:
Create a new
package.jsoninside theapplicationfolder and install packages insideapplication.Modify the
package.jsonon the root folder by adding new package and changeautoload.phplocation
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 Composer “package.json"位置应该在应用程序或根文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:CodeIgniter Composer “package.json"位置应该在应用程序或根文件夹中?
基础教程推荐
- PHP 类:全局变量作为类中的属性 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 如何替换eregi() 2022-01-01
