Dependency Management in PHP

Better Late than Never

Overview

  • What it is dependency management & how it can help you
  • How to discover and use packages
  • How to write (and publish!) your own packages

About Me

  • Sequoia McDowell
  • Software Engineer at PTC
  • @_sequoia
  • sequoia.mcdowell@gmail.com

Package Management

  • What is a package manager?
    ...a collection of software tools to automate the process of installing, upgrading, configuring, and removing software packages for a computer's operating system in a consistent manner.

    dpkg/apt, rpm/yum, npm, rubygems

  • What is a package?
    A package is essentially just a directory containing something.

Example Package: zelenin/curl

www > tree Curl/
Curl/
├── composer.json
├── example.php
├── src
│   └── Zelenin
│       └── Curl.php
└── readme.md

2 directories, 4 files
					

Package Manager vs. Dependency Manager

  • Package Manager: installs packages globally and/or to be invoked independently
  • Dependency Manager: installs packages locally, relative to a project, for the project

What about PEAR?

  • Only one channel for a long time
  • Language features (namespaces)
  • Frameworks
  • Many packages not updated to PHP5
  • Github filled many of the same needs, better
  • vs. Composer: PEAR requires server software, Composer can install from git repo
  • Successes: PEAR installer itself, DB, MDB2; many projects have channels still
  • Still used for: PHP extensions

Summary

  • What & Why of Package Management
  • How to Package Your Application
  • How to Share
  • How to Test

Go forth & package! :)