webDiplomacy icon indicating copy to clipboard operation
webDiplomacy copied to clipboard

Use composer for dependency management

Open splittingred opened this issue 6 years ago • 5 comments

Proposal: Add Composer for dependency management

Modern PHP apps utilize composer for dependency management to allow for external library usage, PSR-4 standards compatibility, and built-in autoloading.

This adds composer to webDip, which only adds one step to be run during initial install (composer install). Note: this would need to be run whenever the code is deployed to the actual server, along with installing composer on it first.

Thoughts? This could allow webDip to benefit from a bunch of external libraries (such as templating, API generation, serialization, DB access, caching, etc).

splittingred avatar Mar 03 '20 13:03 splittingred

I concur. The external phpMailer library already includes some traces of composer. And the library I would like to use for push notifications has some dependencies itself, too, that could be best managed with composer.

Webdip's software already uses an autoload-function itself for the variant extensions, though. And as far as I can judge, this would be broken by your current pull request (had the very same problem just a few days ago). Better add the original autoload function to the spl autoload queue with spl_autoload_register() in variants/variant.php.

diptobi1 avatar Mar 03 '20 20:03 diptobi1

@diptobi1 Good catch - thanks! I've updated the branch to consolidate the PHPMailer autoloader (since we're on PHP 7.0+ now), and adjusted the variant autoloader to use spl_autoload_register with a closure.

splittingred avatar Mar 04 '20 02:03 splittingred

Awesome work!

TimothyJones avatar Mar 06 '20 13:03 TimothyJones

@jmo1121109 @shdant113 Thoughts here?

splittingred avatar Apr 22 '20 18:04 splittingred

Hey, at a first glance this looks really neat. I am not familiar with much in the way of php libraries, and anything being installed on the server has to run through @kestasjk, for security purposes, who is not currently active. So I do want to set the expectation that this may sit for a time.

jmo1121109 avatar Apr 27 '20 04:04 jmo1121109