Use Composer Manager which would allow you to install PHP libraries managed via Composer and their dependencies on a per-project basis.
So (as per module's README.md):
If a module contains a composer.json
file, running composer
install
in its root directory will download all requirements and
dependencies to vendor/
directories with their own autoloaders.
The Guzzle challenge is explained in README.md:
To highlight the challenges, let's say module_a
requires
"guzzle/http": "3.7.*"
and module_b
requires "guzzle/service":
">=3.7.0"
. At the time of this post, running composer install
in
each module's directory will result in version 3.7.4 of guzzle/http
being installed in module_a
's vendor/
directory and version 3.8.1
of guzzle/service
being installed in module_b
's vendor/
directory.
Because guzzle/service
depends on guzzle/http
, you now have
duplicate installs of guzzle/http
. Furthermore, each installation
uses different versions of the guzzle/http
component (3.7.4 for
module_a
and 3.8.1 for module_b
). If module_a
's autoloader is
registered first then you have a situation where version 3.8.1 of
\Guzzle\Service\Client
extends version 3.7.4 of
\Guzzle\Http\Client
.
So by using the Composer Manager's Solution, it finds all composer.json
files in each enabled module's root directory and gracefully merge them into a consolidated composer.json
file (which prevents code duplication and version mismatches).
For the use case above, Composer will resolve both guzzle/http
and
guzzle/service
to version 3.7.4 which is a more consistent, reliable
environment.
So to answer the question: yes, you can include that in a Drupal installation in sites/all/vendor
, e.g.
sites/all/vendor/composer
sites/all/vendor/guzzlehttp