16

does anyone know a package manager library for PHP (as e.g. apt or yum for linux distros) apart from PEAR? I'm working on a system which should include a package management system for module management. I managed to get a working solution using PEAR, but using the PEAR client for anything else than managing a PEAR installation is not really the optimal solution as it's not designed for that. I would have to modify/extend it (e.g. to implement actions on installation/upgrade or to move PEAR specific files like lockfiles away from the system root) and especially the CLI client code is quite messy and PHP4. So maybe someone has some suggestions

  • for an alternative PEAR client library which is easy to use and extend (the server side has some nice implementations like Pirum and pearhub)
  • for completely different package management systems written in PHP (ideally including dependency tracking and different channels)
  • for some general ideas how to implement such a PM system (yes, I'm still tinkering with the idea of implementing such a system from scratch)

I know that big systems like Magento and symfony use PEAR for their PM. Magento uses a hacked version of the original PEAR client (which I'd like to avoid), symfony's implementation seems quite integrated with the framework, but would be a good starting point to at least write the client from scratch. Anyway, if anybody has suggestions: please :)

maff
  • 763
  • 2
  • 7
  • 16
  • 2
    I wouldn't recommend you write a package manager yourself, unless it's for learning purposes. For instance, dependency management is not that easy to get right. – Artefacto May 31 '10 at 18:40
  • Keep us updated if you find something interesting, or really start a new project! ;) Btw, I've lately seen a question here for "gnope" (see sourceforge). Not tested it, but seemed to be a graphical package installer of sorts, likely PEAR related but with relocatable packages. But haven't checked it out really. – mario May 31 '10 at 23:27
  • Apart from the suggestions below, I had a look at symfony's implementation of a PEAR installer, which is a set of classes extending the original PEAR ones. Seems quite straightforward writing an own client implementation on top of the library. – maff Jun 01 '10 at 14:22

3 Answers3

17

There is Composer also.

Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
  • Thanks, surely the way to go now, but wasn't there at that time :) – maff Oct 17 '12 at 09:29
  • 1
    Just to comment on this - per Composer's website, "Composer is not a package manager. Yes, it deals with "packages" or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project. By default it will never install anything globally. Thus, it is a dependency manager." It's subtle, but different. (Still, Composer is great.) – JasCav Feb 14 '14 at 18:55
3

Have you checked Maven for PHP? I've only used Maven in the context of Java applications, but it's certainly:

  • Easy to extend – it's really easy to implement Maven plugins
  • Manages dependencies – distinguishing compile, test and runtime dependencies (though the compile/runtime distintion doesn't make sense in PHP).
  • Repositories are trivial to put up – Apache with mod_dav will give you a working writable repository, but you also have Nexus.
  • Distinguishes snapshot from stable artifacts; allows several policies for when to check for new snapshot artifacts and from which repositories get each type.

And many – many – more things.

Artefacto
  • 96,375
  • 17
  • 202
  • 225
  • I just knew Maven in conjunction with continuous integration, but it seems very powerful - thanks for the suggestion, I'll definitely try it out. – maff Jun 01 '10 at 14:17
1

PEAR2/Pyrus was built for package management for arbitrary applications. I believe it was modeled after the apt/yum architectures.

Helgi - core PEAR member - covers some of it here - http://www.slideshare.net/helgith/pear2-pyrus-the-look-ahead but the documentation is pretty solid too: http://pear.php.net/manual/en/pyrus.extending.installation.php

CaseySoftware
  • 3,105
  • 20
  • 18
  • PEAR2 seems to suffer from namespaceritis. And not the good one. – mario May 31 '10 at 21:18
  • I know Pyrus and thought about using it, but somehow I didn't manage to find the docs you linked to...helps a lot with using the PEAR2 system, thanks. – maff Jun 01 '10 at 14:19
  • @Mathias I'm looking to use it in web2project for all of our module management issue.. I love the dependency management side of things. – CaseySoftware Jun 02 '10 at 16:31