modxcms/revolution — pull request #12063 by rtripault (2014-10-15 21:58:09+00:00)
Title: Composer

Note : this is mainly a PoC to be tested & reviewed

### What does it do ?

* removes dependencies from repository
* make use of Composer to handle dependencies (xPDO included) & some auto loading
* update dependencies (see composer.json)

Note : xPDO is shipped with predis as well as [Garry's PR](https://github.com/modxcms/xpdo/pull/40)

### How to use ?

pull, (make sure you have composer installed) composer install --no-dev, run setup as you would normally do.

I encountered an issue with Smarty dependency :
`Could not scan for classes inside "path/to/core/vendor/smarty/smarty/distribution/libs/Smarty.class.php" which does not appear to be a file nor a folder`

To manually fix, head over to `vendor/composer/installed.json`, search for

"classmap": [
"distribution/libs/Smarty.class.php",
"distribution/libs/SmartyBC.class.php",
"distribution/libs/sysplugins/smarty_security.php"
]

replace with

"classmap": [
"libs/Smarty.class.php",
"libs/SmartyBC.class.php",
"libs/sysplugins/smarty_security.php"
]

run `composer install --no-dev` again.

If you plan to try this on an existing installation, make sure to wipe your `core/cache` folder (encountered some issues with cached Smarty templates)

### What needs to be done/tested ?

- [ ] test with old components (not class based processors/controllers)
- [ ] think about future & potential usage of PHP namespaces
- [ ] find a BC way to move 1 class per file (ie. no multiple classes definitions in a single file)
- [ ] update xPDO to make use of the loader too (no more "require_once")
- [ ] document how to make use of the loader for developers (ie. register classes/namespaces)
- [ ] move composer.json within `core` folder to become available/editable for developers (how will we handle upgrades ?)
- [ ] "post composer" script to clean unnecessary libs stuff (ie. tests, docs) to build a lighter Revo package