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

Decomposing Packages (Symfony Live! San Francis...

Decomposing Packages (Symfony Live! San Francisco 2015)

Using Composer and Packagist makes using 3rd-party code easier but relying on 3rd-party code can have drawbacks. Projects are abandoned. Maintainers become unresponsive. Fortunately, Composer provides tools to help make these situations a little easier to manage. Learn how to leverage Composer features like "replace" and tools like Satis to manage forks of 3rd-party packages. See pros and cons of various methods so that you can feel more confident in how you decide to move forward with decomposing other people's packages.

Beau Simensen

October 30, 2015
Tweet

More Decks by Beau Simensen

Other Decks in Programming

Transcript

  1. Replace says that your app should be installed instead of

    your dependency. Probably almost never what you mean.
  2. Provide says that your app or package has the code

    to satisfy the dependencies of another package. Probably more likely.
  3. What if I actually do need to replace another package?

    You probably want to use self.version.
  4. Consumer's composer.json { "require": { "their-vendor/their-package": "^1.0" }, "repositories": {

    "their-package": { "type": "vcs", "url": "https://github.com/me/their-package" } } }
  5. Consumer's composer.json { "require": { "their-vendor/their-package": "^1.0" }, "repositories": {

    "their-package": { "type": "vcs", "url": "file:///path/to/clone-of/their-package" } } }
  6. as

  7. Consumer's composer.json { "require": { "their-vendor/their-package": "dev-my-fix as 1.0.5" },

    "repositories": { "their-package": { "type": "vcs", "url": "file:///path/to/clone-of/their-package" } } }
  8. Consumer's composer.json { "require": { "their-vendor/their-package": "^1.0" }, "repositories": {

    "their-package": { "type": "path", "url": "../their-package" } } }
  9. Many Stack Middleware Have Pimple 1 at Their Core... {

    "name": "stack/session", "require": { "pimple/pimple": "^1.0" } }
  10. When you install a library, you are responsible for the

    code in that library. — https://igor.io/2013/09/24/dependency- responsibility.html