Based on Why do I have conflicts in namespacing? I adjusted my complete system.
As long as I do namespacing in /src, it is goes all very well.
I included my project from Github. Those class files are located in modules/custom/tb/vendor/ccxt/ccxt/php.
When not working with namespaces I included them with include "vendor\ccxt\ccxt\ccxt.php";
.
How should I include those classes to module? Because of the Composer structure, those files are in the vendor sub-directory.
Because of namespacing in Drupal, use \Drupal\tb\<classfile>
doesn't work.
The content of the composer.json file is the following.
"name": "org/tb",
"description": "This extension provides new commands for Drush.",
"type": "drupal-drush",
"authors": [
{
"name": "Author name",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.6.0",
"arcturial/clickatell": "^3.0",
"ccxt/ccxt": "^1.14"
},
"extra": {
"drush": {
"services": {
"drush.services.yml": "^9"
}
}
}
}
composer require ccxt/ccxt
, then ccxt's namespaces will be available to your code