Package Builder: Build a RPM or DEB package from Composer project

Recommend this page to a friend!
  Info   Documentation   View files (9)   Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 116 All time: 9,206 This week: 341
Version License PHP version Categories
package-builder 1.4BSD License5.3PHP 5, Utilities and Tools, Unix
Description Author

This package can be use to build a RPM or DEB package from Composer project.

It takes the name of package in a Composer repository and extracts the files to build a package file to be installed on Linux systems.

The packages can generated in either the RPM or DEB formats.

Innovation Award
PHP Programming Innovation award nominee
July 2015
Number 11
Composer provides a means to install PHP packages from repositories.

However, for Linux distributions, sometimes it is more convenient to distribute and install packages in the native Linux distribution format.

This package can create RPM or DEB package files to be installed on Linux systems from packages taken from a Composer repository.

Manuel Lemos
Picture of Sergey Vanyushin
  Performance   Level  
Name: Sergey Vanyushin is available for providing paid consulting. Contact Sergey Vanyushin .
Classes: 15 packages by
Country: Russian Federation Russian Federation
Age: 24
All time rank: 61319 in Russian Federation Russian Federation
Week rank: 61 6 in Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 15x

Winner: 2x


Package Builder

Command-line utility that builds a package from composer project.

Composer packacge Latest Stable Version Build Status Latest Unstable Version License

What it does

  1. PackageBuilder creates a package for your current OS (in fact, for your distributive): deb (for Debian-based) or rpm (for Fedora-based). You can install it package or share to other people.
  2. All files of your package will be installed in /usr/lib/[package name] folder.
  3. To all binaries (specified in `bin` section of `composer.json`) will be made symbolic links and placed in /usr/local/bin/. That way you will be able use them like any other system program.

Package type

By default, utility uses os detection to decide what format of package should be used.

For now, it supports following package formats: deb* - uses automatically on Debian installation. You can force using this format by adding --type deb in console. rpm* - uses automatically on Fedora installation. You can force using this format by adding --type rpm in console.

How to package your project

  1. Create clean and lite version of your package. For this manual let's take a mythical package `taifun/tornado`:
    mkdir package-build && cd package-build
    composer create-project --prefer-dist --no-dev taifun/tornado .
  2. Install Package Builder globally. Skip this step if you have done this before.
    composer global require wapmorgan/package-builder
  3. Add another path of autoloader in your binaries. All files of your package will be placed in /usr/lib/[package name]/ folder, so composer autoloader will be available by /usr/lib/[package name]/vendor/autoload.php path. [package name] is not the same as composer package name. You can use any that is not used in your system. For demonstrating purposes let's use `simplepackage`.
    $paths = [
        '/usr/lib/simplepackage/vendor/autoload.php', // this line added
    function init_composer(array $paths) {
        foreach ($paths as $path) {
            if (file_exists($path)) {
                require_once $path;
                return true;
        return false;
    if (!init_composer($paths)) die('Run `composer install` firstly.'.PHP_EOL);
  4. Launch a Packaging Wizard. It will ask for additional information and finally build a package and store it in one-level above directory.
    pbuilder build .

A resulting ready-to-install deb or rpm-package will be stored in file ../simplepackage-version.deb or ../simplepackage-version-release.rpm.


  1. Why do I need to package php scripts?

    May be you want to take control of all files on your PC and just like your package manager.

  2. What preinstalled steps is needed to build a package?

    * On Debian-based:

    - Install packages: ```sh build-essential ```

    * On Fedora-based:

    - Install build packages: - @development-tools - fedora-packager - rpmdevtools - Create build tree: ```sh rpmdev-setuptree ```

  3. Can I build a package with different type than my OS uses?

    No, PackageBuilder uses system commands like `dpkg` and `rpmbuild` to create a package.

File Role Description
bin (1 file)
src (1 file, 1 directory)
tests (1 file)
.travis.yml Data Auxiliary data
composer.json Data Auxiliary data Data Auxiliary data Doc. Documentation

  Files  /  bin  
File Role Description
   pbuilder Appl. Script that calls the class

  Files  /  src  
File Role Description
Application (2 files)
   PackageConfiguration.php Class Class source

  Files  /  src  /  Application  
File Role Description
   Application.php Class Class source
   BuildCommand.php Class Class source

  Files  /  tests  
File Role Description
   BuildCommandTest.php Test Unit test script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,206
This week:341

For more information send a message to info at phpclasses dot org.