[pkg-php-pear] Composer packages autoloader

Shawn Iwinski shawn.iwinski at gmail.com
Mon Jun 27 21:28:44 UTC 2016


That pkg-php-tools is almost exactly another project I started working
towards :)  ..... on the side and no public code available yet though
because to be honest I'd have to find it as it has been a little while
since I touched it.

I think we could come up with a "self" autoload generator but the
dependencies are where it would get tricky -- if everything was PSR-0 it
would be easy, but PSR-4 makes it tricky.  Let's say Symfony version 2 is
installed at `{BASE_DIR}/symfony/` and Symfony version 3 is installed at
`{BASE_DIR}/symfony3/` then the autoload generator would need to need to
know exactly which base directory to use.  There are also some dependencies
that do not provide `{BASE_DIR}/autoload.php` autoload files and instead
need to use `{BASE_DIR}/autoload-{SOME_DESC}.php`.

I did start some kind of rudimentary autoload-generator for packaging for
Symfony 3:
https://github.com/siwinski/rpms/blob/master/php-symfony3/php-symfony3-generate-autoloaders.php
.  Each sub-pkg gets its' own stand-alone autoload.php file.  We've also
redone the logic for required/optional dependencies that I did not port
over to that generator as well.

I'm also thinking that because of the differences in distro rules and pkg
formats we'd have to create custom layers on top of this autoloader lib.
Would you picture your idea as an all-inclusive pkg/lib or something build
on top of this autoloader lib?

Also, if we'd like to share stuff perhaps we could come up with another
namespace or is the `Fedora` namespace fine?

On Wed, Jun 22, 2016 at 2:49 PM, Mathieu Parent (Debian) <sathieu at debian.org
> wrote:

> 2016-06-22 15:44 GMT+02:00 David Prévot <taffit at debian.org>:
> > [Forwarding a message from Fedora people with their consent, keeping
> > them CC since they’re not subscribed.]
> >
> > Le 21/06/2016 à 04:37, Ondřej Surý a écrit :
> >> On Tue, Jun 21, 2016, at 06:42, Remi Collet wrote:
> >>> > Hi Ondrej,
> >>> >
> >>> > Having look at some Debian packages, I think maintainers are using a
> >>> > solution close to our, to manage autoloader [1]
> >>> >
> >>> > Our documentation:
> >>> > https://fedoraproject.org/wiki/SIGs/PHP/PackagingTips#Autoloader
> >>> >
> >>> > For now we are using classmap, Zend or Symfony autoloaders which are
> >>> > mostly un-maintained as nearly everybody use composer outside of
> distro.
> >>> >
> >>> > Using them could also become a nightmare when we'll have 2 versions
> of
> >>> > the same framework (e.g. symfony 2 and 3)
> >>> >
> >>> > So we are thinking to create a Fedora Autoloader, without any
> >>> > dependencies, used in our packages.
> >>> > https://github.com/siwinski/php-fedora-autoloader
> >>> >
> >>> > This is a work in progress, really in "devel" state.
> >>> >
>
> Thanks for this, and thanks for sharing.
>
> We really need cross-distro cooperation on this topic (and others, ...).
>
> The code is great, but couldn't we go a little bit further, and
> directly parse composer.json and construct the autoload file from it?
>
> In Debian, we use pkg-php-tools which is able to map PEAR or Composer
> metadata and dependencies to there deb equivalent. Merging autoloader
> code in pkg-php-tools would benefit both Fedora and Debian. The code
> is at:
>
> http://anonscm.debian.org/cgit/pkg-php/pkg-php-tools.git/tree/
>
> [...]
> Cheers
>
> --
> Mathieu Parent
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-php-pear/attachments/20160627/3ed93802/attachment.html>


More information about the pkg-php-pear mailing list