Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Package managers in other languages

igorw edited this page · 4 revisions

It seems PHP is one of the few languages without an incredible package manager. Add to that the fact that we only recently got namespaces and classloaders and it's no wonder that our language attracts mega-frameworks. It's easier to add your code to an existing framework than to write small, re-usable components.

PEAR

I'll be upfront, I don't know a huge amount of details about the architectural choices behind PEAR. I'm sure they were sensible at the time, but in my 10 years of PHP every single time I've tried to use PEAR in a development project it has been a painful experience. Writing XML package descriptions is painful, as I'm sure is parsing them. Aesthetically, having package names like HTTP_Request2 and Cache_Lite is just not particularly inspiring. Sure, it's not cutesy like a lot of the gem names, but it's verbose, awkward and makes it confusing as to whether the library is part of the language or an addition.

Pear.php.net presently has 568 packages. Rubygems.org has 23,918 at last count. Something is broken. I have two words for you "formal proposal".

  • Packages are described with a package.xml file, this can be generated with an inspection tool
  • Packages are installed by pear tool into the system pear directory, overwriting previous versions
  • The system pear directory is included in PHP's include_path
  • Channels provide a way to aggregate packages into a distribution channel. Simplified by Pirum

RubyGems and Bundler

Gems are re-usable bundles of Ruby code. RubyGems provides infrastructure for describing gems, bundling them into gems and submitting them to Rubygems.org. This is quick and easy. Gems can then compete on equal footing, based on which is better able to attract developers.

Bundler provides a layer over this for managing gem dependencies for an individual project. A project can have gem dependencies from Rubygems.org, or can pull in dependencies via git, svn, etc. This means you can develop your re-usable libraries as you develop you code, and have granular control over which versions you are running and over which versions users of your software will have.

  • Packages are described with a Gemspec, which is in Ruby
  • Anyone can publish gems on rubygems.org
  • Gems are installed system-wide, and the latest version is activated. Multiple versions are able to be installed at once.

Further reading:

Something went wrong with that request. Please try again.