In my project I have a folder for modules where they can have composer packages
The namespace for the module I'm making is Modules\View\View for Modules/View/View.php file
this is the directory layout
Modules
-View
--View.php
--vendor
---autoload.php
when I do this in View.php
public function __construct(){
require_once __DIR__.'/vendor/autoload.php';
$this->loader = new Twig_Loader_Filesystem('design');
$this->twig = new Twig_Environment($this->loader);
}
I get an error: Fatal error: Class 'Modules\View\Twig_Loader_Filesystem' not found in Modules/View/View.php on line 12
So I assumed this is because the View.php file has a namespace and I went to /Modules/View/vendor/composer/autoload_namespaces.php and changed
'Twig_' => array($vendorDir . '/twig/twig/lib')
to
'Modules\View\Twig_' => array($vendorDir . '/twig/twig/lib')
and it still doesn't work, however I'm still 100% sure it's because of the namespace because if you try to load it in a file without a namespace it works but as soon as you add it it gives that error