Composing PHP projectsA new PHP package manager       Nils Adermann    naderman@phpbb.com         @naderman      September...
NIH (Not Invented Here)Wikipedias list of template engines:  33 PHP  15 Python  3 RubyLists of >100 PHP engines on the web...
Symfony2 PackagesLibraries / ComponentsBundlesPSR-0 AutoloadingEveryone is using Git(hub)
phpBB PackagesphpBB3 MODX Extensions (>= 3.1)phpBB4 Regular Symfony2 Bundles “ ExtensionBundles”
Packages for End-UsersWeb UI browsing, installing, removing, updating changes made in copy of vendor directory   A) overwr...
Packages for developersConsistent versions across dev machinesProject specific package versionsEasy definition of dependen...
PEAR / PEAR2 / PyrusMost people still use PHP4 PEARPEAR2 requires PHP 5.3  uses namespacesPyrus is the PEAR2 Installer  ph...
Problems Pyrus does not solveConsistent versions across machinesWeb UI with vendor directory  hardcoded output, paths  dir...
Channels in PEARPEAR requires explicit channelsChannels cannot replace foreign packageYou need to know channel locations
ComposerSimple JSON declaration of packagescomposer.lock fileVirtual PackagesDependency Resolution with SAT
Composer RepositoriesAnything  Git Repository, tar.gz, Local directory, ...Restriction to repository of approvedpackages p...
Packagisthttp://packagist.orgCentral repository of packagesAll kinds of packages allowed  Libraries  Framework Bundles/Plu...
SAT?Boolean Satisfiability Problem:  Can (A|B)&(C|D|(E&(A|D))&E be true?D(isjunctive)NF:  (A&B)|(C&D&A)|(B&D)|CC(onjunctiv...
NP?“ hard”   problemspolynomial: n, n^2, n^3, 5n^4 + 2n^2 ...  100^2 = 10,000  100^3 = 1,000,000exponential: 2^n, 100^n, 1...
NP?“ nondeterministic polynomial time”  no known polynomial time algorithm which:    - can solve all instances of the prob...
Package ManagementPoolRepositoriesPackage  Name & Version  requires, conflicts, provides
Dependency ResolutionUser wants to:- install some packages- update some packages- remove some packages- keep some packages
Dependency ResolutionEDOS Project Workpackage 2 Team. Report on formal management of software dependencies. EDOSProject De...
Dependency ResolutionIdeal:
Dependency ResolutionAcceptable:
Dependency ResolutionNo solution:  APT  PortagePoor solution:  smart  Urpmi
Dependency Resolution with SAT SUSEs libzypper (Michael Schroeder) Goals:   Fast   Complete & Reliable   Understandable me...
Rule GenerationJob Rules: Install A: (A) Remove A: (-A)
Rule GenerationDependency Rules:  A requires B: (-A|B1|B2)  A conflicts with B: (-A|-B1), (-A|-B2)  C and D provide A: A r...
Solving RulesUnit Propagation: (A|B|C), (-C), (-A|C)   (-C)         C: false   (-A|C)       A: false (-A: true)   (A|B|C) ...
Rule Solving AlgorithmUnit Propagation  Contradiction?    Add Rule -X or unsolvable    Backtrack to previous assignmentAss...
Free ChoicesKeep installed packages installedDo not install unecessary packagesPick newest version
Composer Demo
Resourceshttps://github.com/composerhttp://packagist.org/abouthttp://packagist.org/about-composerhttp://google group ...
Thank you!             and Michael Schröder at Novell for his slideshttp://files.opensuse.org/opensuse/en/b/b9/Fosdem2008-...
Upcoming SlideShare
Loading in...5
×

Composer

1,069

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,069
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
6
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Composer

  1. 1. Composing PHP projectsA new PHP package manager Nils Adermann naderman@phpbb.com @naderman September 10th 2011
  2. 2. NIH (Not Invented Here)Wikipedias list of template engines: 33 PHP 15 Python 3 RubyLists of >100 PHP engines on the webWhy is PHP at the top?
  3. 3. Symfony2 PackagesLibraries / ComponentsBundlesPSR-0 AutoloadingEveryone is using Git(hub)
  4. 4. phpBB PackagesphpBB3 MODX Extensions (>= 3.1)phpBB4 Regular Symfony2 Bundles “ ExtensionBundles”
  5. 5. Packages for End-UsersWeb UI browsing, installing, removing, updating changes made in copy of vendor directory A) overwrite old directory after update B) download & upload vendor directory C) (S)FTP support
  6. 6. Packages for developersConsistent versions across dev machinesProject specific package versionsEasy definition of dependencies in a fileAbility to work on dependencies codeSimple definition of own packages
  7. 7. PEAR / PEAR2 / PyrusMost people still use PHP4 PEARPEAR2 requires PHP 5.3 uses namespacesPyrus is the PEAR2 Installer phar archive per-project package repositories
  8. 8. Problems Pyrus does not solveConsistent versions across machinesWeb UI with vendor directory hardcoded output, paths directory transactions prevent self-updateWorking on dependencies codeNon-PHP dependencies
  9. 9. Channels in PEARPEAR requires explicit channelsChannels cannot replace foreign packageYou need to know channel locations
  10. 10. ComposerSimple JSON declaration of packagescomposer.lock fileVirtual PackagesDependency Resolution with SAT
  11. 11. Composer RepositoriesAnything Git Repository, tar.gz, Local directory, ...Restriction to repository of approvedpackages possibleRepositories can provide same packages Prefered Repositories
  12. 12. Packagisthttp://packagist.orgCentral repository of packagesAll kinds of packages allowed Libraries Framework Bundles/Plugins/whatever Application Plugins (e.g. Drupal/Wordpress)
  13. 13. SAT?Boolean Satisfiability Problem: Can (A|B)&(C|D|(E&(A|D))&E be true?D(isjunctive)NF: (A&B)|(C&D&A)|(B&D)|CC(onjunctive)NF: (A|B)&(C|D|A)&(B|D)&C
  14. 14. NP?“ hard” problemspolynomial: n, n^2, n^3, 5n^4 + 2n^2 ... 100^2 = 10,000 100^3 = 1,000,000exponential: 2^n, 100^n, 100^5n, ... 2^100 ~= 1,267,650,600,000,000,000,000,000,000,000
  15. 15. NP?“ nondeterministic polynomial time” no known polynomial time algorithm which: - can solve all instances of the problem - does not need to try all combinationsSAT is NP-complete (Cooks theorem)
  16. 16. Package ManagementPoolRepositoriesPackage Name & Version requires, conflicts, provides
  17. 17. Dependency ResolutionUser wants to:- install some packages- update some packages- remove some packages- keep some packages
  18. 18. Dependency ResolutionEDOS Project Workpackage 2 Team. Report on formal management of software dependencies. EDOSProject Deliverable Work Package 2, Deliverable 2, March 2006. http://www.edos-project.org/xwiki/bin/Main/Deliverables.
  19. 19. Dependency ResolutionIdeal:
  20. 20. Dependency ResolutionAcceptable:
  21. 21. Dependency ResolutionNo solution: APT PortagePoor solution: smart Urpmi
  22. 22. Dependency Resolution with SAT SUSEs libzypper (Michael Schroeder) Goals: Fast Complete & Reliable Understandable messages & explanations Based on ideas from minisat
  23. 23. Rule GenerationJob Rules: Install A: (A) Remove A: (-A)
  24. 24. Rule GenerationDependency Rules: A requires B: (-A|B1|B2) A conflicts with B: (-A|-B1), (-A|-B2) C and D provide A: A requires C or DPolicy Rules: B1 can be updated to B2: (B1|B2) B2 obsoletes B1: (-B1|-B2)
  25. 25. Solving RulesUnit Propagation: (A|B|C), (-C), (-A|C) (-C) C: false (-A|C) A: false (-A: true) (A|B|C) B: true
  26. 26. Rule Solving AlgorithmUnit Propagation Contradiction? Add Rule -X or unsolvable Backtrack to previous assignmentAssign undecided variable X (free choice)Repeat until solved
  27. 27. Free ChoicesKeep installed packages installedDo not install unecessary packagesPick newest version
  28. 28. Composer Demo
  29. 29. Resourceshttps://github.com/composerhttp://packagist.org/abouthttp://packagist.org/about-composerhttp://google group ...
  30. 30. Thank you! and Michael Schröder at Novell for his slideshttp://files.opensuse.org/opensuse/en/b/b9/Fosdem2008-solver.pdf http://www.mancoosi.org/edos/manager/ http://en.opensuse.org/openSUSE:Libzypp_satsolver Questions?
  1. A particular slide catching your eye?

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

×