php使用框架外的codeigniter框架组件


php use codeigniter framework components outside of framework

我正在开发一个遗留项目,该项目是用代码点火器框架2.1.0版本构建的(是的,我知道它很旧)。我正在尝试将Illuminate Queue系统集成到CI中,并且做得很好。当侦听命令脚本从队列中提取作业并调用该类并在该类上执行fire方法时,我遇到的问题是使用CI项。

有可能在这样的东西中使用Codeigniter项吗?

以下是名称空间区域的文件夹结构:

application
    MyApp
        Queues
            Listeners
                Exports
                     Exports.php

这是文件:

<?php namespace MyApp'Queues'Listeners'Exports;
use Aws'S3'S3Client;
use League'Flysystem'Filesystem;
use League'Flysystem'Adapter'AwsS3 as Adapter;
use League'Flysystem'AdapterInterface;
class Exports
{
    public function __construct()
    {
        /* Load CI */
        $this->ci = & get_instance();
    }
    public function fire($job, $data)
    {
        // Process job
        $job->delete();
    }
}

这是它通过的错误信息:

PHP Fatal error:  Call to undefined function MyApp'Queues'Listeners'Exports'get_instance()

我知道发生这种情况是因为core/Codeigner.php文件没有被加载,因为它是一个在本地服务器后台运行的CL命令,而不是通过打开框架的典型路径。

我所问的可能吗?如果你需要任何进一步的信息,请告诉我。

谢谢!

Illuminate是否可以通过Composer获得?Phil Sturgeon在这里写了一篇关于让作曲家在CI工作的好教程:http://philsturgeon.uk/blog/2012/05/composer-with-codeigniter