Free Software Developer
https://github.com/naderman
phpBB Development Lead
https://www.phpbb.com
Composer Co-Author
https://getcomposer.org
Professional Managed phpBB Hosting & Consulting around PHP & Composer
https://www.forumatic.com
“When people are incompetent in the strategies they adopt to achieve success and satisfaction, they suffer a dual burden: Not only do they reach erroneous conclusions and make unfortunate choices, but their incompetence robs them of the ability to realize it. Instead, like Mr. Wheeler, they are left with the erroneous impression they are doing just fine.”
Dunning Kruger Effect
http://opinionator.blogs.nytimes.com/2010/06/20/the-anosognosics-dilemma-1
“the ability of technological advancement to do ‘more and more with less and less until eventually you can do everything with nothing’.”
Wikipedia
... and it's not just for big clusters either
git clone https://github.com/symfony/standard-edition myproject
Cloning into myproject...
cd myproject/
curl -s http://getcomposer.org/installer | php
All settings correct for using Composer
Composer successfully installed to: /home/bob/myproject/composer.phar
Use it: php composer.phar
php composer.phar install
Installing from lock file
- Package twig/extensions (dev-master)
Downloading
Unpacking archive
Cleaning up
[...]
- Package twig/twig (1.8.0)
Downloading
Unpacking archive
Cleaning up
- Package symfony/symfony (dev-master)
Downloading
Unpacking archive
Cleaning up
Generating autoload files
vendor/ autoload.php composer/ monolog/ monolog/ symfony/ symfony/ monolog-bundle/ twig/ twig/ extensions/ [...]
{ "require": { "silex/silex": ">=1.0.0-dev", "symfony/finder": "2.1-dev", "twig/twig": "1.*", "predis/service-provider": "dev-master" "symfony/console": "~2.1" }, "require-dev": { "mikey179/vfsStream": "*" } }
composer install
(installs your dependencies)composer update
(updates your dependencies)Libraries/projects define their namespaces:
"autoload": { "psr-0": { "Vendor\\Namespace": "lib/" }, "classmap": ["src/", "VeryOld.php"] }, "include-path": ["src/", ""]
Composer builds an autoloader for you:
vendor/autoload.php
Use the generated autoloader:
require __DIR__.'/../vendor/autoload.php'; use Silex\Application; use Silex\Extension\TwigExtension; use Symfony\Component\Finder\Finder; use Symfony\Component\HttpFoundation\Response; $app = new Application(); // ...
Symfony2, Laravel, Silex, Lithium ...
Assetic, Guzzle, Monolog, Twig, Imagine, ...
$x = $request->query->get('x', 0); $addX = function($a) use ($x) { return $a+$b; } $newNumbers = array_map($addX, $numbers);
$a = [1, 3, 5, 9];
function xrange($start, $limit, $step = 1) { for ($i = $start; $i <= $limit; $i += $step) { yield $i; } } foreach (xrange(1, 9, 2) as $number) { echo "$number "; }
"name": "drupal/drupal", "description": "Drupal is an open source content management platform powering millions of websites and applications.", "type": "drupal-core", "license": "GPL-2.0+", "autoload": { "psr-0": { "Drupal\\Core": "core/lib/", "Drupal\\Component": "core/lib/", "Drupal\\Driver": "drivers/lib/" }, "files": [ "core/lib/Drupal.php" ] }, "config": { "vendor-dir": "core/vendor", "preferred-install": "dist", "autoloader-suffix": "Drupal8" }
"require": { "php": ">=5.4.2", "sdboyer/gliph": "0.1.*", "symfony/class-loader": "2.4.*", "symfony/dependency-injection": "2.4.*", "symfony/event-dispatcher": "2.4.*", "symfony/http-foundation": "2.4.*", "symfony/http-kernel": "2.4.*", "symfony/routing": "2.4.*", "symfony/serializer": "2.4.*", "symfony/validator": "2.4.*", "symfony/yaml": "dev-master#e49a47d60348665261f6e279ba383241deb73cab", "twig/twig": "1.15.*", "doctrine/common": "dev-master#a45d110f71c323e29f41eb0696fa230e3fa1b1b5", "doctrine/annotations": "dev-master#463d926a8dcc49271cb7db5a08364a70ed6e3cd3", "guzzlehttp/guzzle": "4.0.*", "kriswallsmith/assetic": "1.1.*@alpha", "symfony-cmf/routing": "1.1.*@alpha", "easyrdf/easyrdf": "0.8.*", "phpunit/phpunit": "3.7.*", "zendframework/zend-feed": "2.2.*" },