How to Use Zend Library without installation of Zend Framework

前端 未结 3 722
北恋
北恋 2021-01-02 02:14

How to use zend library without using zend framework installation?

I am trying to use zend library(Mail and Mime) without zend framework installation, its not return

3条回答
  •  甜味超标
    2021-01-02 02:46

    I've done it more than once to integrate zend libs in other non-zend projects. Autoloader is not suggested for just inclusion of some libraries as it involves in worse performances (see zend reference about |end_Loader for that). The best way (from both clear code and performances point of view) is very simple:

    1) set the include path: (necessary or you'll have fatal inclusion errors):

    set_include_path(implode(PATH_SEPARATOR, array(
        '/',
        get_include_path(),
    )));
    

    2) do a "require_once" of the library/ies you need, following the structure Zend/ e.g:

    require_once "Zend/Mail.php"; 
    //you can use now Zend_Mail* classes
    

    note1: you don't have to place a "require_once" of all the needed classes, the main included class already do a require_once of the dependent classes.

提交回复
热议问题