How to autoload a third party library in an extbase 6.2 extension?

756 Views Asked by At

I am trying to embed a third party library in a custom extbase extension on TYPO3 6.2, to be able to authenticate to dropbox.

https://github.com/kunalvarma05/dropbox-php-sdk

As the library is supposed to be installed via composer, I did this locally and uploaded the generated filed to the server. I now have the following additional directories:

ext:myext
+Classes
  +vendor
    +composer
    +guzzlehttp
    +kunalvarma05/dropbox-php-sdk/src/Dropbox

The namespace for the dropbox library is Kunnu\Dropbox, the main Class is Kunnu\Dropbox\DropboxApp;

I expected automatic discovery of that namespace, as it's located in Classes. So I embedded it in my Controller as such (also tried DI, same effect)

   namespace STUBR\Myext\Controller;
   use Kunnu\Dropbox\DropboxApp;

And later on in the class $app = new \DropboxApp("client_id", "client_secret");

The Result:

Could not analyse class:Kunnu\Dropbox\DropboxApp maybe not loaded or no autoloader?

Next try; I followed http://insight.helhum.io/post/130876393595/how-to-configure-class-loading-for-extensions-in (which is for TYPO3 7.x, but makes references to 6.x too) and tried the two following variants in ext_emconf.php:

'autoload' => array(
  'psr-4' => array('Kunnu\\Dropbox\\' => 'Classes')
),

or

'autoload' =>
array(
  'classmap' => array('Classes')
),

Same (non-)effect.

I don't think I have to go down the road of adding an ext_autoload.php, as everything is namespaced, right? So I guess I'm doing something completely wrong here. Maybe I shouldn't include the library in classes, but create some kind of separate wrapper extension that's a dependency for my extension?

What is the right approach?

0

There are 0 best solutions below