Yii2 basic use Zend Framework 1 library

143 Views Asked by At

I have successfully using Zend Framework 1 library in CodeIgniter

This is how I do it

  1. copy the folder Zend in Zend framework's path/library
  2. paste in CodeIgniter's system/libraries
  3. in CodeIgniter's system/libraries, add Zend.php with this content

    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    class Zend {  
      function __construct($class = NULL) {   
      // include path for Zend Framework   
      // alter it accordingly if you have put the 'Zend' folder elsewhere
    
      ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . FCPATH . 'system/libraries');
        if ($class) {
          require_once (string) $class . EXT;
          log_message('debug', "Zend Class $class Loaded");
        } else {    
          log_message('debug', "Zend Class Initialized");
        }  
      }
    
      function load($class) {   
        require_once (string) $class . EXT;        
        log_message('debug', "Zend Class $class Loaded");  
      }
    }
    
  4. This is example how I use it in CodeIgniter's controller

    //load it inside function __construct()
    $this->load->library('Zend');
    $this->zend->load('Zend/Feed');
    $this->zend->load('Zend/Search/Lucene');
    
    //use it inside function
    $index = new Zend_Search_Lucene( "assets/index" );
    query = "yes";
    $hits = $index->find($query);
    

Now, I want to use Zend Framework 1 library in Yii2 basic

I have copied the folder Zend in Zend framework's path/library

Pasted it to Yii2 basic path/vendor folder

How to set and use Zend Framework 1 library in Yii2 basic?

Brief explanation appreciated! Thanks before

0

There are 0 best solutions below