Graphviz and pear inclusion

Up to now I have written non-yii code for the generation of Graphviz images to be included in my site. I use the pear GraphViz library which works perfectly fine for this. Now I try to migrate my working code to the basic setup of Yii2, but the autoloading of pear library does not seem to work anymore.

What I have done is the following:

in the directory views I created a subdirectory BigPicture with the index file:


<?php


use yii\helpers\Html;


/* @var $this yii\web\View */


$this->title = Yii::t('app', 'The Big Picture');

$this->params['breadcrumbs'][] = $this->title;

?>

<div class="bigpicture-index">

    <?php  echo $mysvg; ?>

</div>



in the directory controllers I created the BigpictureController:


<?php


namespace app\controllers;


use Yii;

//use app\models\Catalog;

use yii\web\Controller;

use yii\web\NotFoundHttpException;

use yii\filters\AccessControl;

use yii\filters\VerbFilter;

use app\includes\CBigPicture;




/**

 * BigPictureController generates the Big Picture.

 */

class BigpictureController extends Controller

{

    public function behaviors()

    {

        return [

            'access' => [

                'class' => AccessControl::className(),

                'only' => ['index'],

                'rules' => [

                    [

                        'actions' => ['index'],

                        'allow' => true,

                        'roles' => ['@'],

                    ],

                ],

            ],

			'verbs' => [

				'class' => \yii\filters\VerbFilter::className(),

				'actions' => [

					'index'  => ['get'],

				],

			],

        ];

    }


    /**

     * Lists all Catalog models.

     * @return mixed

     */

    public function actionIndex()

    {

		$bp = new CBigPicture();

		$connectstring = "host=localhost dbname=somedb user=" . $_SESSION['username'] . " password=" . $_SESSION['password'];


		$bp->con = pg_connect($connectstring)

			or die("Could not connect to server...\n"); 

		$bp->page_frame();

        return $this->render('index', [

            'mysvg' => $bp->outstream,

        ]);

    }


}



I created a directory includes under basic, in which I store the class generating the image:

and the GraphViz Pear class (patched downloaded version)Attachment 6517 not found.

It all runs OK until the image must be created, the error I get with this code is:

Attachment 6519 not found.

As you can see, all classes run fine until the pear part (calling System.php and related files) spoils the fun.

Any suggestions? Installing the pear/pear package from packagist did not do it for me :(

solved it, see also stackoverflow, question importing-class-without-namespace-to-namespaced-class

I needed a \ in fromt of the call to graphviz and the inclusion following the correct path.