0

I have Symfony 3.4.27 installed in the application I am working on. Twig is installed in the vendor\twig\twig\ folder.

My problem is when I run the command composer dumpautoloader. It does not register that twig is vendor folder. I tried to manually add Twig to the autoload_psr4.php file inside the vendor\composer folder. However, that did not work out for me because when I ran the dump autoloader command again. It wiped out what I manually put in the system.

I checked the twig\twig folder for the composer.json file it is there. I tried How to update a single library with Composer?

 composer update vendor/twig

It replied Package "vendor/twig" listed for update is not installed. Ignoring.

So, how do I get composer to register the twig package?

user1794918
  • 1,131
  • 2
  • 16
  • 34
  • `vendor/twig` is not a valid package, and Composer won't "register" any package for you. `twig/twig` is the proper package name. Additionally, please never edit anything in the `vendor` folder, no autoloader files (which are autogenerated), no code in any package – Nico Haase May 14 '20 at 08:45
  • Well, I was pretty sure the manually editing files would be a bad idea. However, when I ran the command composer update twig/twig it returned Package "twig/twig" listed for update is not installed. Ignoring. I have found CentOS to be very problematic for install Symfony twig. The twig that is installed is out of date and does not work with Symfony. – user1794918 May 14 '20 at 21:22
  • What do you mean by "does not work with Symfony"? As both have been developed by the same developer, that sounds strange. Usually, Twig itself is completely decoupled from Symfony. And if Twig is not installed yet, why not do so using `composer require twig/twig`? – Nico Haase May 15 '20 at 05:56
  • The twig that is installed on the CentOS server has a different directory structure than the one on the Ubuntu server. On ubuntu the directory structure is twig\twig\src. The directory structure on CentOS is twig\twig\lib\Twig this is where the files that are in the src directory and there is no src directory on the CentOS. So the code was developed on the Ubuntu server. But that really wouldn't matter if the composer would register the directory structure in the autoload_files.php and the composer.json. – user1794918 May 15 '20 at 10:41
  • The error message of not being installed is because there is no entry in the composer.json file for twig. – user1794918 May 15 '20 at 10:51
  • I found this site https://centos.pkgs.org/7/epel-x86_64/php-twig-extensions-1.3.0-1.el7.noarch.rpm.html but it does not install twig in my web application. It is installs something totally different from the OS which cannot be used in the web app in my opinion. I looked in the directories and it is nothing like the ubuntu install. – user1794918 May 15 '20 at 11:01

0 Answers0