php - Dynamic Dependencies for larger library -
let's have library contains multiple parts, , b.
in application require library use part only. defined thru config setting in application can read dynamically.
now , b have different requirements other packages.
how require dependencies if used?
the obvious answer split library 2 libraries. library not split , require big effort of work , change workflow - don't want. think of eg. zend framework single library.
the best way removing both , b "require" section , adding them "suggest" section instead (including short description):
{ ... "suggest": { "a/a": "to able use x (1.*)", "b/b": "to able use y (~1.3)" } }
now, when user installs package, it'll message showing suggested packages:
package/package suggests installing "a/a": able use x (1.*) package/package susgests installing "b/b": able use y (~1.3)
the user installing package should determine theirselves if want require "a/a" or "b/b".
while solution 1 of used , simple, better option split package. see "there’s no such thing optional dependency"
Comments
Post a Comment