How to use custom library in zf2 Reviewed by Momizat on . How to use custom library in zf2,custom namesapce in zf2, custom class in zf2 We can use all folder library and create a custom Namespace.Like PHPExcel and Twil How to use custom library in zf2,custom namesapce in zf2, custom class in zf2 We can use all folder library and create a custom Namespace.Like PHPExcel and Twil Rating: 0

How to use custom library in zf2

How to use custom library in zf2,custom namesapce in zf2, custom class in zf2

We can use all folder library and create a custom Namespace.Like PHPExcel and Twilio both are library folder.

<?php
/**
 module/Admin/Module.php

 */
public function getAutoloaderConfig() {
        return array(
            'Zend\Loader\ClassMapAutoloader' => array(
                __DIR__ . '/autoload_classmap.php',
            ),
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                    'PHPExcel' => __DIR__ . '/../../vendor/PHPExcel',
                    'Twilio' => __DIR__ . '/../../vendor/Twilio',
                ),
            ),
        );
    }
?>

We can use all class files as library and create a custom Namespace.Like PHPExcel.php and IOFactory.php both are library files.

<?php
/**
 module/Admin/autoload_classmap.php

 */
return array(
    'PHPExcel' => 'vendor/PHPExcel/PHPExcel.php',
    'PHPExcel_IOFactory' => 'vendor/PHPExcel/PHPExcel/IOFactory.php',  
    
    
);
?>

Leave a Comment

© 2014 Powered By