-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with Guzzle (PSR4 transforming) #39
Comments
If 2 Besides, the way Guzzle includes if (!function_exists('GuzzleHttp\uri_template')) {
require __DIR__ . '/functions.php';
} This if/else condition is kind of custom autoloader. So far, imposter supports composer autoloaders only. Pull requests are welcomed. Both the above issues stop you from using imposter. Perhaps, using WHMCS's Guzzle is the simplest solution. |
Darn - thanks for the fast reply. Unfortunately, I hoped Imposter was a solution for having multiple composer autoloaders and multiple So my modules manage their own composer.json where I added Imposter. Unfortunately using WHMCS's Guzzle isn't really possible - as my own dependencies use Guzzle, and as far as I know I can't "flag" Guzzle in my composer.json manually as installed. |
After a second thought, the first issue is incorrect. You usage is similar to the project goal - make 2 WordPress plugins bundle their composer packages without conflicts. However, imposter can't be used on custom autoloaders(issue 2).
One thing you could try is to use branch aliases - alias a "fake", "empty" package as guzzle. |
Hmm - thanks for your response. After my reply I further continued searching and eventually found PHP Scoper, which does the same - but on a more aggressive level. With some custom code and an additional script to change package ID's in |
Detailed description
I'm maintining a wide variaty of WHMCS modules. Recently WHMCS seems to started using Composer in their own, closed source, software - which conflicts with my modules. Since them I'm looking for such a plugin as Imposter to fix my dependency issues.
Most things seems to work just fine, expect with Guzzle and loading PSR-4 classes.
For example a trace I gathered. Here the core WHMCS software requests Guzzle, and the autoloader seems to respond with my transformed Guzzle instance:
This results in either incompatbility or
Cannot declare class DevApp\WHMCS\MollieRecurring\Vendor\GuzzleHttp\Client, because the name is already in use in /var/www/*/app/modules/addons/mollierecurring/vendor/guzzlehttp/guzzle/src/Client.php on line 25
-errors.Also - the autoloading files for Guzzle does not work. This because Guzzle includes this file, which checks if
GuzzleHttp\uri_template
is loaded - but most of the time it is (because of the core software, which already has Guzzle loaded) and so my namespace's Guzzle functions won't get loaded.WHMCS loads Composer itself and I'm not sure how their composer.json looks like. Mine is, for example:
Context
It is important to me to keep using my current packages (I don't use guzzle directly, but most of my packages do). This could also benefit other people, as Guzzle is a widely used package to handle HTTP requests.
Possible implementation
Unsure. Maybe manually update the PSR-4 mapping?
Your environment
The text was updated successfully, but these errors were encountered: