Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include external library in Zend Framework 2?

I played with the zf2-tutorial successfully, but I was totally confused when trying to integrate an external library like "jpgraph". I know I must do this with autoload or servicemanager but it won't work. The php-files of jpgraph are in the vendor/graph directory. I use a module called Jpgraph, in the controller indexAction I try:

$graph = new Graph($width,$height);

this gives me an error:

Fatal error: Class 'Jpgraph\Controller\Graph' not found in ...

the jpgraph library don't use namespaces.

i also tried this way without success

what's the best way to integrate such things?

I would be glad for every tip or help

like image 702
Jochen Kast Avatar asked Oct 16 '12 13:10

Jochen Kast


1 Answers

Add the library to your composer.json and add the class with Classmap and/or the include path as phpunit does

https://github.com/sebastianbergmann/phpunit/blob/master/composer.json#L48

like image 57
Maks3w Avatar answered Sep 20 '22 21:09

Maks3w