I have a Laravel project that works fine locally (Mavericks), but classes under psr-4 aren't loading on our stage server (CentOS). I'm getting a Reflection "class not found" error every time I try composer update, or run an artisan command.
All my app-specific classes are stored in my Laravel project under app/heatherland, eg:
app/heatherland/import/ImportJob.php (file contains HeatherLand\Import\ImportJob)
My composer.json contains this entry:
"autoload": {
"classmap": [
"app/commands",
...
"app/database/seeds",
],
"psr-4": {
"HeatherLand\\": "app/heatherland"
}
},
Locally, the psr-4 classes are added to the array in vendor/composer/autoload_classmap.php. They're not added to this file on the stage server. If I cut and paste them manually, artisan commands work properly, but the next time I run a composer command, the autoload file is overwritten. The autoload_psr4.php on both local and stage has the following entry, which looks fine to me:
'HeatherLand\\' => array($baseDir . '/app/heatherland'),
Here's is a list of stuff I've tried/checked:
- The case of the class, folder and file names is consistent and correct.
- I've been using composer dump-autoload liberally, with and without the -o option
- I can run composer update with the --no-scripts option fine, but artisan still won't run
- Folder names are lower-case,
and I've tried changing them to reflect case of the namespaces(edit: this never happened, at least not successfully). - I've tried removing CamelCase from my namespace (eg, changing it to Heatherland), and there aren't any underscores in any of my folder/filenames.
- I'm running PHP 5.4.30, and composer is up-to-date. Versions are identical on my local setup and stage server. Laravel 4.1.30.
- No duplicate composer.phar in either system
Any new advice welcome. At this point, I'd be really happy if I've done something silly.
"HeatherLand\\Import\\":"app/heatherland/import"
for this namespace prefix. – Willingham