Skip to content


added composer.json #12

merged 1 commit into from

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.


@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;

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


+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

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 :)


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


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


@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 !


Please don't feed the trolls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 11, 2012
  1. @lsmith77

    added composer.json

    lsmith77 committed
Showing with 22 additions and 0 deletions.
  1. +22 −0 composer.json
22 composer.json
@@ -0,0 +1,22 @@
+ "name": "facebook/php-sdk",
+ "description": "Facebook PHP SDK",
+ "keywords": ["facebook", "sdk"],
+ "type": "library",
+ "homepage": "",
+ "license": "Apache2",
+ "authors": [
+ {
+ "name": "Facebook",
+ "homepage": ""
+ }
+ ],
+ "require": {
+ "php": ">=5.2.0",
+ "ext-curl": "*",
+ "ext-json": "*"
+ },
+ "autoload": {
+ "classmap": ["src"]
+ }
Something went wrong with that request. Please try again.