I'm working on a module which will require a library that is already in composer.
I added a line to my module's composer.json file:
"require": {
"markrogoyski/math-php" : "dev-master"
}
I ran the command:
composer update .
and a "vendor" directory was created in my module's directory and the files were downloaded. However, If I add a use statement to the file my_module/src/Controller/Test.php I get an error:
----Test.php----
<?php
namespace Drupal\lims\Controller;
use Drupal\Core\Controller\ControllerBase;
use Math\Functions\Map\Single;
class Sample extends ControllerBase {
public function content() {
print_r(Single::square([1,2,3,4,5]));
}
}
I see the error:
PHP Fatal error: Class 'Math\\Functions\\Map\\Single' not found in [module path]/src/Controller/Test.php on line 9
Is there another step that I need to do to get the library autoloaded in the correct namespace?