I am using Silex (and so, composer) for any web application project.
I would like to autoload 4 entities and forms:
The composer.json is defined with a psr-0 array:
{
"require": {
"silex/silex": "~1.0",
[...]
},
"autoload": {
"psr-0": {
"FSB": "src/"
}
}
}
Then in my index.php file I just call :
use FSB\MyProject\Entity\Contact;
use FSB\MyProject\Form\ContactType;
use FSB\MyProject\Entity\Booking;
use FSB\MyProject\Form\BookingType;
$contact = new Contact();
Everything works fine in my dev-environment, MAMP, php 5.4
But it breaks on my production server, Apache2 on Ubuntu with PHP 5.4 too
"PHP Fatal error: Class 'FSB\MyProject\Entity\Contact' not found in /[...]/index.php"
I've tried many ways to load my entities like :
{
"require": {
"silex/silex": "~1.0",
[...]
},
"autoload": {
"psr-0": {
"FSB/Palmeraie": "src/",
}
}
}
Or even:
{
"require": {
"silex/silex": "~1.0",
[...]
},
"autoload": {
"psr-0": {
"FSB\\Palmeraie\\Entity": "src/",
"FSB\\Palmeraie\\Form": "src/"
}
}
}
--> Several ways are working in my dev-environment ; none on my production environment...
Did I miss something ?
Check your file/directory names for correct capitalization, file names on OS X are case insensitive opposed to those on Linux/Unix file systems.