Question

I am trying to integrate the Temboo SDK with the Laravel framework so that it autoloads like the rest of the vendors.

The SDK has the following structure:

temboo
    src
        library
            temboo._23andme.php
            temboo._37signals.php
            etc...
        temboo.php

Within the main Temboo file, they have multiple class declarations and each one uses naming such as class Temboo_Session and the classes in the library dir are of the form class _23andMe_Names extends Temboo_Choreography.

The temboo.php class file also includes an autoloader class Temboo_Loader and declaration spl_autoload_register(array('Temboo_Loader', 'autoload'));

This is my first time trying to integrate a non-PSR-0 library, so I am a little lost on this.

Any help would be appreciated.

Was it helpful?

Solution

You can tell Composer to autoload any (non-PSR) class by adding the base folder to:

"autoload": {
    "classmap": [
        "app/commands",
        "app/database/migrations",
        "app/database/seeds",
        "app/tests/TestCase.php"
    ],
    ....

And you can also autoload autoloaders by adding them to the files section:

"autoload": {
    "files": [
        "temboo/src/Temboo_Loader.php"
    ],
...

After adding those entries, execute

composer dumpautoload

And check the file vendor/composer/autoload_classmap.php, the available classes must be all listed in it, if one file is not there it will not be autoloaded.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top