1

I am working on a legacy project that is built with the codeigniter framework, version 2.1.0 (yes I know it's old). I am attempting to integrate the Illuminate Queue system into CI and have done so quite well. The problem I am running into is using CI items when the listening command script pulls a job from the queue and calls the class and executes the fire method on that class.

Is it possible to use Codeigniter items in something that is called as such, and is namespaced?

Here is the folder structure of the namespaced area:

application
    MyApp
        Queues
            Listeners
                Exports
                     Exports.php

And here is the file:

<?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();
    }

}

And this is the error message it throughs:

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

I know this is happening because the core/Codeigniter.php file isn't being loaded since it is a CL command running in the background on my local server and not going through the typical route of opening the framework.

Is what I'm asking possible? Let me know if you need any further information.

Thanks!

klye_g
  • 1,242
  • 6
  • 31
  • 54

1 Answers1

0

Isn't Illuminate available via Composer? Phil Sturgeon wrote a nice tutorial on getting Composer to work in CI here: http://philsturgeon.uk/blog/2012/05/composer-with-codeigniter

twistedpixel
  • 1,212
  • 4
  • 14
  • 33