added composer.json #12

merged 1 commit into from Mar 16, 2012


None yet

This PR add a composer.json manifest file.

Composer is a new packager manager that is seeing significant adoption in the PHP scene by the likes of Symfony, Doctrine, FuelPHP .. see

Even Drupal is looking into adopting it

Do note that its still under development.

For more information see
The index of currently available packages is here

Note once the composer.json is added the git repo also needs to be registered on As you are already tagging releases no additional steps are necessary in the future, as the site will automatically will pickup new releases based on the tags.

/cc @scottmac @seldaek


I should add that I have not signed the CLA, but since this is not a code contribution I figure its not necessary.



I do think this is a code contribution but of different type. Maybe someone else that had signed the CLA can copy your code and do the PR for you to avoid problems.

jmikola commented Mar 16, 2012

@lsmith77: Does "autoload": {"classmap": ["src"]} allow Composer's autoloader to properly handle facebook.php and base_facebook.php? I know we've had trouble autoloading those classes in the past, since they don't mesh with PSR-0.

I know this is getting Symfony2-specific, but isn't that why FOSFacebookBundle relies on the file attribute of the service definition to manually load the dependency?

I'll also ping @oyvindkinsey here, since he was the last FB dev to merge a PR two months ago :)


Indeed classmap deals with libs that are not PSR-0 compliant:


// autoload_classmap.php generated by Composer

$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);

return array(
    'FacebookApiException' => $baseDir . '/vendor/facebook/php-sdk/src/base_facebook.php',
    'BaseFacebook' => $baseDir . '/vendor/facebook/php-sdk/src/base_facebook.php',
    'Facebook' => $baseDir . '/vendor/facebook/php-sdk/src/facebook.php',

// autoload.php generated by Composer
if (!class_exists('Composer\\Autoload\\ClassLoader', false)) {
    require __DIR__.'/ClassLoader.php';

return call_user_func(function() {
    $loader = new \Composer\Autoload\ClassLoader();

    $map = require __DIR__.'/autoload_namespaces.php';

    foreach ($map as $namespace => $path) {
        $loader->add($namespace, $path);

    $classMap = require __DIR__.'/autoload_classmap.php';
    if ($classMap) {


    return $loader;
maoueh commented Mar 16, 2012

Nice move, this would allow me to avoid using custom repositories within my composer.json file. Big +1 on this one.

jclaros commented Mar 16, 2012

+1 it should be an standard to use composer in all projects related with php


Yes, please merge that.

@scottmac scottmac merged commit aba1cc4 into facebookarchive:master Mar 16, 2012

After discussion around the CLA, we can merge this without one as Lukas has agreed to submit it under the Apache 2.0 license.


Cool! Thanks :)

ebuildy commented Jul 14, 2012

Sound like Php is becoming a messy merge of Java and Ruby On Rails ;-)


@ebuildy actually, this is just package management...


Quiet down there troll.

On 14 Jul 2012, at 23:36, Marco wrote:

@ebuildy actually, this is just package management...

Reply to this email directly or view it on GitHub:
#12 (comment)

ebuildy commented Jul 16, 2012

@Ocramius yes and its a very good thing for Php developper (what I am...), just said composer its just a copy of "gem" from RoR (same thing for Symfony2 which is a copy of Java concepts ....), but yes its a really cool tool !

mhughes commented Jul 16, 2012

Please don't feed the trolls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment