Search code examples
symfonycomposer-phpliipimaginebundle

Imagine Bundle conflict minimum


I'd like to install liip/imagine-bundle in my symfony 2 project. But in order to make barcodes, I installed previously MopaBarcodeBundle.

MopaBarcodeBundle requires "avalanche123/imagine-bundle" which requires imagine/imagine: v0.4.1

And

LiipImagineBundle requires imagine/imagine: ~0.5,<0.7

Obviously composer detects the conflict, as he cannot unistall v0.4.1, and that version is not enough for LiipImagine.

I'd like to know how I could bypass this. Create sorts of aliases in composer and keep the two versions on my project ? I'm not a pro in version management, so I guess this is not possible.

Thank you very much for any help.


Solution

  • Ok, after some code inspection i figured out a way around. MopaBarcodeBundle doesn't really requires avalanche123/imagine-bundle, but it uses it in the service declaration. (To make the link with Imagine classes).

    So I changed the service.xml file containing the BarcodeService declaration.

    <parameter key="imagine.gd.class">Imagine\Gd\Imagine</parameter>
    
    
    <service id="imagine" alias="imagine.gd" /> 
    <service id="imagine.gd" class="%imagine.gd.class%" />
    

    I guess thoses lines could be factorised, but i chose to keep it as it was done in avalanche123.

    Also a constant from avalanche was used in 5th argument, I changed it to :

    <argument>%kernel.root_dir%../web</argument>
    

    Finally I removed avalanche, and then install a newer version of imagine/imagine