[Kolab-devel] PHP composer and packaging
Thomas Brüderli
bruederli at kolabsys.com
Thu Feb 20 17:14:10 CET 2014
Thomas Brüderli wrote:
>>> Let's gather the options and stakes on this topic and find a sustainable
>>> way for the ongoing Kolab development.
>> I couldnt agree more: composer is for developers and doesn't help much
>> packagers as it describe dependencies but not file paths.
>>
>> In the Debian pkg-php team, we have a tool named pkg-php-tools which
>> converts automatically PEAR/PECL or Composer deps to Debian deps. It
>> also ensure files are installed in the right place (PEAR/PECL only).
I'm trying to follow-up on this although nobody clearly endorsed nor
objected against my previous suggestion.
After investigating the routine composer uses to create the autoload
files, it turns out that we'd need some additional tricks to fake the
actual composer module installation process which doesn't take place
with distribution packages. Therefore I quickly whipped up a script that
does the necessary changes and can be executed in the post-install hook
of a composer module distribution package.
> I'd say that's a start. What about this idea:
>
> 1. Create a package with composer and its autoloading magic and install
> it in a global location like /usr/share/php:
>
> /usr/share/php/composer.phar
> /usr/share/php/vendor/autoload.php
> /usr/share/php/vendor/composer/
Package composer-add-package.php from
https://gist.github.com/thomascube/9117025 into the basic composer
package, together with a copy of composer.phar from getcomposer.org:
/usr/share/php/composer.phar
/usr/share/php/composer-add-package.php
> 2. Create individual packages for composer-based libraries and install
> them to /usr/share/php/vendor/. e.g.
>
> /usr/share/php/vendor/sabre/dav
> /usr/share/php/vendor/sabre/vobject
> /usr/share/php/vendor/sabre/symfony/yaml
>
> 3. After installing a package, execute
$ cd /usr/share/php/
$ php composer-add-package.php vendor/sabre/dav/composer.json 1.8.7
$ php composer.phar dump-autoload --optimize
> to update the classmap for autoloading.
>
> 4. When packaging projects like iRony or Roundcube which may use
> composer, use the composer.json file as a human readable source of
> dependency definitions and create a symlink for the vendor directory:
>
> <project-dir>/vendor -> /usr/share/php/vendor
>
> That way, developers can keep on using composer.json to define
> dependencies and can use composer to install them for their local
> project-related development environment and when distributed with the
> php-composer distribution packages, autoloading still works as expected.
Anyone?
~Thomas
More information about the devel
mailing list