Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Composer - Менеджер пакетов для PHP. Серебрянная пуля?

Dd3f18c87b851137000c7427d7bd5d32?s=47 fwdays
November 14, 2011

Composer - Менеджер пакетов для PHP. Серебрянная пуля?

Dd3f18c87b851137000c7427d7bd5d32?s=128

fwdays

November 14, 2011
Tweet

More Decks by fwdays

Other Decks in Programming

Transcript

  1. Composer — Package Management for PHP. Silver Bullet? Kirill chEbba

    Chebunin Billix iam@chebba.org http://github.com/chEbba @iamchEbba
  2. Problem

  3. Dependent Libraries

  4. Dependent Libraries

  5. Dependent Libraries

  6. Many Separate Projects

  7. Overview of Tools  Python: easy_install, pip  Ruby: gems

     Java: maven, ivy  C#(.NET): NuGet, NuPack  PHP: PEAR/Pyrus
  8. PEAR. Why NOT?  #pyrus mypear = hack  Channel1/Package1

    != Channel2/Package1  No “Source”, only “Dists”  Special Package Type (+/-)
  9. Composer. Silver Bullet?

  10. Composer. Simple  #wget http://getcomposer.org/composer.phar  #vi /path/to/project/.composer.json  #php

    composer.phar install  PEAR package on release?
  11. Composer. File { "require": { "vendor/package1": "1.3.2", "vendor/package2": "1.*", "vendor/package3":

    ">=2.0.3" } }
  12. Composer. Fundamentals  Package Repository = Metadata  Storage Separated

    from Repository  Unique Package Name = vendor/package  Different Storage Types (Downloaders)  “Source” & “Dist”  Dependecy Resolver
  13. Composer. Repository File "composer\/composer":{ "name":"composer\/composer", "description":"Package Manager", "maintainers":[], "versions":{ "master-dev":{

    "require":{ "php":">=5.3.0", "symfony\/console":"2.0.5", "symfony\/finder":"2.0.5" } } } }
  14. Composer. Repository  PlatformRepository (php & extensions)  ComposerRepository ($url/composer.json)

     PearRepository (PEAR channel support)  VcsRepository (github, git, svn, hg)  LocalRepository?
  15. Composer. Downloader "source":{ "type":"git", "url":"http:\/\/github.com\/composer\/composer.git", "reference":"e6c3929ea9f7d732ed3352dc06ed950af140ebf7", "shasum":"" }, "dist":{ "type":"zip",

    "url":"<...>e6c3929ea9f7d732ed3352dc06ed950af140ebf7", "shasum":"e32a4bac17d56533393b856699491c4c02f3e1ab", "reference":"e6c3929ea9f7d732ed3352dc06ed950af140ebf7" }
  16. Composer. Downloader  ZipDownloader (dist)  TarDownloader (dist: tar, tar.gz,

    tar.bz2)  PharDownloader (dist)  PearDownloader (dist: uses tar)  GitDownloader (source)  HgDownloader (source)
  17. Composer. Installer  LibraryInstaller (vendor/*) "composer\/composer":{ "name":"composer\/composer", "description":"Package Manager", "type":"library"

    }
  18. Composer. Dependency Resolver  OpenSUSE's Libzypp satsolver  Requires 

    Conflicts  Provides  Replaces  Recommends  Suggests
  19. Composer. Dependency Resolver "require":{ "php":">=5.3.0", "symfony\/console":"2.0.5", "symfony\/finder":"2.0.5" }

  20. Composer. Autoload  PSR-0 Autoloading (.composer/autoload.php) "versions":{ "master-dev":{ "autoload":{ "psr-0":{

    "Composer":"src\/" } } } }
  21. Questions? =)