How to use autoloader in Restler?

367 views Asked by At

I have a problem with autoloading Restler. I wanted to use a bootstrap/autoloader in my application and looked at this tutorial, which was good for me as a PHP beginner. But it doesn't work with Restler. Why?

Composer created/downloaded all files without any problem.

This is my code for the bootstrap.php:

 <?php
 require_once dirname(__FILE__) . '/../vendor/autoload.php';

And this is my index.php (Restler) file:

 <?php
 #require_once '/../../vendor/luracast/restler/vendor/restler.php';
 require_once dirname(__FILE__) . '/../bootstrap.php';
 use Luracast\Restler\Restler;
 use Luracast\Restler\Defaults;

 Defaults::$throttle = 20;

 $r = new Restler();
 $r -> addAPIClass('defaultCall', '');
 $r -> addAPIClass('API');
 $r -> handle();

But it doesn't work. If I change the '#' and load the restler.php file as usual, everything works.

Any suggestions?

0

There are 0 answers