• Like
Composer
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Composer

  • 1,006 views
Published

 

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,006
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
4
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Composing PHP projectsA new PHP package manager Nils Adermann naderman@phpbb.com @naderman September 10th 2011
  • 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. Symfony2 PackagesLibraries / ComponentsBundlesPSR-0 AutoloadingEveryone is using Git(hub)
  • 4. phpBB PackagesphpBB3 MODX Extensions (>= 3.1)phpBB4 Regular Symfony2 Bundles “ ExtensionBundles”
  • 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. 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. 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. 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. Channels in PEARPEAR requires explicit channelsChannels cannot replace foreign packageYou need to know channel locations
  • 10. ComposerSimple JSON declaration of packagescomposer.lock fileVirtual PackagesDependency Resolution with SAT
  • 11. Composer RepositoriesAnything Git Repository, tar.gz, Local directory, ...Restriction to repository of approvedpackages possibleRepositories can provide same packages Prefered Repositories
  • 12. Packagisthttp://packagist.orgCentral repository of packagesAll kinds of packages allowed Libraries Framework Bundles/Plugins/whatever Application Plugins (e.g. Drupal/Wordpress)
  • 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. 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. 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. Package ManagementPoolRepositoriesPackage Name & Version requires, conflicts, provides
  • 17. Dependency ResolutionUser wants to:- install some packages- update some packages- remove some packages- keep some packages
  • 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. Dependency ResolutionIdeal:
  • 20. Dependency ResolutionAcceptable:
  • 21. Dependency ResolutionNo solution: APT PortagePoor solution: smart Urpmi
  • 22. Dependency Resolution with SAT SUSEs libzypper (Michael Schroeder) Goals: Fast Complete & Reliable Understandable messages & explanations Based on ideas from minisat
  • 23. Rule GenerationJob Rules: Install A: (A) Remove A: (-A)
  • 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. Solving RulesUnit Propagation: (A|B|C), (-C), (-A|C) (-C) C: false (-A|C) A: false (-A: true) (A|B|C) B: true
  • 26. Rule Solving AlgorithmUnit Propagation Contradiction? Add Rule -X or unsolvable Backtrack to previous assignmentAssign undecided variable X (free choice)Repeat until solved
  • 27. Free ChoicesKeep installed packages installedDo not install unecessary packagesPick newest version
  • 28. Composer Demo
  • 29. Resourceshttps://github.com/composerhttp://packagist.org/abouthttp://packagist.org/about-composerhttp://google group ...
  • 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?