Composer
A Lightning Talk by James Titcumb
● Your app depends on libraries
● Maintenance - keeping up to date
● Libraries depend on other libraries
● Could result in...
nooooo!!!!!!
Nils Adermann (phpBB)
Jordi Boggiano (SF2, Doctrine)
Say hello to...
What Does It Do?
● You tell it what libraries you want
● Manages dependencies
● Installs them (downloads them)
● Creates a...
Installing composer.phar
$ curl -sS https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for us...
composer.json
{
"require": {
"php": ">= 5.3",
"symfony/console": "2.3.*"
}
}
Now Install
$ php composer.phar install
Loading composer repositories with package information
Installing dependencies (in...
Where Did You Come From?
● Packagist - main repository
● You can make your own (Satis)
Autoloading!
index.php
<?php
require 'vendor/autoload.php';
// You can use your dependencies
// without requiring them all...
60 seconds Live Demo (!)
● Download Composer
● Create composer.json
● Run Composer install
● Write index.php
● It’s very simple
● Magical dependencies (recursively)
● You can make your own packages!
● Composer autoloader rocks (PSR...
Thanks!
@asgrim
github.com/asgrim
Upcoming SlideShare
Loading in...5
×

Composer Tutorial (PHP Hampshire Sept 2013)

3,094

Published on

Watch the presentation video here: http://www.youtube.com/watch?v=nnDUSkvdvWg

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,094
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
68
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Composer Tutorial (PHP Hampshire Sept 2013)

  1. 1. Composer A Lightning Talk by James Titcumb
  2. 2. ● Your app depends on libraries ● Maintenance - keeping up to date ● Libraries depend on other libraries ● Could result in conflicting code - MESS The Problems Guzzle Twig PSR-3 Pimple
  3. 3. nooooo!!!!!!
  4. 4. Nils Adermann (phpBB) Jordi Boggiano (SF2, Doctrine)
  5. 5. Say hello to...
  6. 6. What Does It Do? ● You tell it what libraries you want ● Manages dependencies ● Installs them (downloads them) ● Creates an autoloader
  7. 7. Installing composer.phar $ curl -sS https://getcomposer.org/installer | php #!/usr/bin/env php All settings correct for using Composer Downloading... Composer successfully installed to: composer.phar Use it: php composer.phar $
  8. 8. composer.json { "require": { "php": ">= 5.3", "symfony/console": "2.3.*" } }
  9. 9. Now Install $ php composer.phar install Loading composer repositories with package information Installing dependencies (including require-dev) - Installing symfony/console (v2.3.4) Downloading: 100% Writing lock file Generating autoload files $
  10. 10. Where Did You Come From? ● Packagist - main repository ● You can make your own (Satis)
  11. 11. Autoloading! index.php <?php require 'vendor/autoload.php'; // You can use your dependencies // without requiring them all the time use SymfonyComponentConsoleApplication;
  12. 12. 60 seconds Live Demo (!) ● Download Composer ● Create composer.json ● Run Composer install ● Write index.php
  13. 13. ● It’s very simple ● Magical dependencies (recursively) ● You can make your own packages! ● Composer autoloader rocks (PSR-0/4) ● Simplifies deployment! ● Get it here: Summary getcomposer.org
  14. 14. Thanks! @asgrim github.com/asgrim
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×