Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I made a library to access to the Taleo data ( https://github.com/Polzme/Taleo ). I tried to follow the best practice to do it. It's using composer ( http://getcomposer.org/ ) to resolve dependencies to Monolog and Guzzle.

Now, the big question is, how to use my library 'Taleo' in a Drupal module ?

I tried with xautoload ( http://drupal.org/project/xautoload ) and composer_autoload ( http://drupal.org/project/composer_autoload ) without success.

I also tried to include the file 'vendor/autoload.php', but it doesn't works (and it works well in the demo.php file: https://github.com/Polzme/Taleo/blob/master/demo.php)

Before including each file manually, I would like to know if there is a working solution available for Drupal 7.


share|improve this question
Not closing this as a duplicate question (namespaces and dependencies make it different enough), but you may want to take a look at drupal.stackexchange.com/questions/42266/… for inspiration. – MPD Nov 5 '12 at 15:46

It is indeed possible with xautoload.

Here is some explanation what initially went wrong: https://gist.github.com/4018045

As a general guide:

function hook_libraries_info() {
  return array(
    'Taleo' => array(
      'name' => 'Taleo PHP Library',
      'xautoload' => function($api) {
        // $api already knows the library path.
        // 'src' is relative to that.
        $api->namespaceRoot('Taleo', 'src');

The $api object is explained here: http://drupalcode.org/project/xautoload.git/blob/refs/heads/7.x-2.x:/lib/InjectedAPI/hookXautoload.php

share|improve this answer
I worked on the doc pages. drupal.org/node/1976206 – donquixote Apr 25 '13 at 0:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.