Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

627
Views
Laravel resolving a new namespace - which files to add namespace data

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?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!