Would be sweet if we could autoload libraries downloaded with composer.

If we agree that sites/all/vendor and sites/$sitename/vendor are the correct place, then we are good to go, are we?

Comments

donquixote’s picture

StatusFileSize
new1.21 KB

Here is a patch. Should do the job. But needs some testing!

donquixote’s picture

Status: Active » Needs review
donquixote’s picture

One question would be: Is there any reason to not do this by default? E.g. should we make this optional, so the user needs to enable the feature? I don't really see why, I don't think there could be anything other than the composer stuff in sites/*/vendor/composer/autoload_*.php.

donquixote’s picture

And btw, why not use autoload.php created by composer?
(See also #1433256-20: Proposal: Composer as a Library Manager ff)

Because:
- Performance (1): xautoload has an APC cache, that will also be used for composer. More funky cache mechanics might be added in the future.
- Performance (2): The fewer separate class loaders we register with spl_autoload_register(), the better. (and unlike classloader, xautoload does not get slower with more namespaces)
- Flexibility: It allows to register more than one composer dir, without any duplicate classes being defined.

Caveat:
- Do we know for sure that composer/autoload_namespaces.php will always be provided by composer?
- Do we know for sure that sites/*/vendor will be the definitive place for composer stuff in D7 ?

clemens.tolboom’s picture

The order for loading the classes seems ok .. first the all and then overwrite with the site specific. Or is it working the other way around?

- Flexibility: It allows to register more than one composer dir, without any duplicate classes being defined.

The biggest problem lies in version conflicts thus an inconsistent merge over versions.

clemens.tolboom’s picture

Issue summary: View changes
Status: Needs review » Active

Why isn't this patch picked-up by the testbot?

clemens.tolboom’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: xautoload-7.x-3.x-composer-1923724-1.patch, failed testing.

donquixote’s picture

Status: Needs work » Closed (duplicate)

I think this should be discussed on the Composer manager queue.
#1943536: Integrate with contributed class loader modules