Within my extension I can load classes from CiviCRM's core codebase like this:
$foo = new \Civi\Core\AssetBuilder();
And I can also load custom classes that I've written in my extension like this:
$foo = new CRM_MyExtension_MyClass();
But if I've defined a custom class within my extension using the
Civi namespace, the following does not work:
$foo = new \Civi\MyExtension\MyClass();
It fails with this error message:
Error: Class 'Civi\MyExtension\MyClass' not found in ...
How can I load this custom class from within my extension?