• Using multiple versions of a component

    From Arno Welzel@21:1/5 to All on Sat Jul 2 02:04:01 2022
    Recently I came across the followig problem:

    Using Composer to manage dependencies for a WordPress plugin, in
    particular to include Twig to make it easier to generate the backend UI.

    So the code looks similar to this:

    <?php
    namespace MyPlugin;

    use Twig\Loader\FilesystemLoader;
    use Twig\Environment;

    require(__DIR__ . '/vendor/autoload.php');

    ...

    However - this caused a problem with another plugin which also use Twig
    but in a different version. As the other plugin was loaded first the
    older version of it was already present. Also having multiple
    autoloaders seems not to be a wise idea anyway.

    Is there any "best practice" to deal with this or should one just not
    try to do such things?


    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ace of diamonds@21:1/5 to All on Wed Jul 6 09:19:30 2022
    Hey guy. Would You want to get rich with me doing programming? If yes, call me !!!!!!!!!

    ✆☎☏📱📞 : 372 53900660


    Arno Welzel kirjutas Laupäev, 2. juuli 2022 kl 02:04:10 UTC+2:
    Recently I came across the followig problem:

    Using Composer to manage dependencies for a WordPress plugin, in
    particular to include Twig to make it easier to generate the backend UI.

    So the code looks similar to this:

    <?php
    namespace MyPlugin;

    use Twig\Loader\FilesystemLoader;
    use Twig\Environment;

    require(__DIR__ . '/vendor/autoload.php');

    ...

    However - this caused a problem with another plugin which also use Twig
    but in a different version. As the other plugin was loaded first the
    older version of it was already present. Also having multiple
    autoloaders seems not to be a wise idea anyway.

    Is there any "best practice" to deal with this or should one just not
    try to do such things?


    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)