Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #19026

Using multiple versions of a component

Path csiph.com!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Arno Welzel <usenet@arnowelzel.de>
Newsgroups comp.lang.php
Subject Using multiple versions of a component
Date Sat, 2 Jul 2022 02:04:01 +0200
Lines 29
Message-ID <ji9gbiF1jsjU1@mid.individual.net> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace individual.net Yz8Z8dj5gXfAhrXWZ7v9ow80KeAQqU6XMJdUvG+NHfYB1U8flD
Cancel-Lock sha1:CD+Qss3gWhp6h4djNwchPFI3Pvw=
Content-Language de-DE
Xref csiph.com comp.lang.php:19026

Show key headers only | View raw


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

Back to comp.lang.php | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Using multiple versions of a component Arno Welzel <usenet@arnowelzel.de> - 2022-07-02 02:04 +0200
  Re: Using multiple versions of a component Ace of diamonds <he12091983@gmail.com> - 2022-07-06 09:19 -0700

csiph-web