In Laravel 4, in app/config/app.php
, I find the following line under providers
:
'Illuminate\Workbench\WorkbenchServiceProvider',
And that service provider works because I verify the register()
method is called. I wondered how this maps out namespace-wise. It appears at least in part that the namespace Illuminate
is declared here in /vendor/composer/autoload_namespaces.php
:
'Illuminate' => array($vendorDir . '/laravel/framework/src'),
I have created a folder in /vendor
called
/vendor/mycompany
And then create a class file called MyClass.php as follows
<?php namespace MyCompany;
#MyClass.php
class MyClass{
..etc..
}
I then add the same line in /vendor/composer/autoload_namespaces.php
:
'MyCompany' => array($vendorDir . '/mycompany'),
And call the following in routes.php:
$test = new MyCompany\MyClass; //line 15
print_r(class_get_methods($test)); //line 16
BUT, I get this error:
Fatal error: Class 'MyCompany\MyClass' not found in .. line 15
How do I solve this and get the namespace MyCompany
registered and recognized?