Skip to content
This repository

added composer.json #12

Merged
merged 1 commit into from about 2 years ago

12 participants

Lukas Kahwe Smith Luis Cordova Jeremy Mikola Matthieu Vachon Jonathan Claros Santander Dmitry Belyakov Scott MacVicar Nils Adermann eBuildy Marco Pivetta Phil Sturgeon mhughes
Lukas Kahwe Smith

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 http://philsturgeon.co.uk/blog/2012/03/packages-the-way-forward-for-php

Even Drupal is looking into adopting it http://drupal.org/node/1398772).

Do note that its still under development.

For more information see http://getcomposer.org/
The index of currently available packages is here http://packagist.org/

Note once the composer.json is added the git repo also needs to be registered on packagist.org. 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

Lukas Kahwe Smith

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

Luis Cordova

+1

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.

Jeremy Mikola

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

Lukas Kahwe Smith

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


<?php

// 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',
);
<?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) {
        $loader->addClassMap($classMap);
    }

    $loader->register();

    return $loader;
});
Matthieu Vachon

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

Jonathan Claros Santander

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

Dmitry Belyakov

Yes, please merge that.

Scott MacVicar scottmac merged commit aba1cc4 into from March 16, 2012
Scott MacVicar scottmac closed this March 16, 2012
Scott MacVicar
Owner

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

Nils Adermann

Cool! Thanks :)

eBuildy

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

Marco Pivetta

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

Phil Sturgeon
eBuildy

@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

Please don't feed the trolls

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

Showing 1 unique commit by 1 author.

Mar 11, 2012
Lukas Kahwe Smith added composer.json 1fee484
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 22 additions and 0 deletions. Show diff stats Hide diff stats

  1. 22  composer.json
22  composer.json
... ...
@@ -0,0 +1,22 @@
  1
+{
  2
+    "name": "facebook/php-sdk",
  3
+    "description": "Facebook PHP SDK",
  4
+    "keywords": ["facebook", "sdk"],
  5
+    "type": "library",
  6
+    "homepage": "https://github.com/facebook/facebook-php-sdk",
  7
+    "license": "Apache2",
  8
+    "authors": [
  9
+        {
  10
+            "name": "Facebook",
  11
+            "homepage": "https://github.com/facebook/facebook-php-sdk/contributors"
  12
+        }
  13
+    ],
  14
+    "require": {
  15
+        "php": ">=5.2.0",
  16
+        "ext-curl": "*",
  17
+        "ext-json": "*"
  18
+    },
  19
+    "autoload": {
  20
+        "classmap": ["src"]
  21
+    }
  22
+}
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.