dev-master
9999999-devAutoload testing between psr-0 and psr-4
The Requires
- php >=5.3.0
- guzzlehttp/guzzle 4.*
by Frank
Wallogit.com
2017 © Pedro Peláez
Autoload testing between psr-0 and psr-4
.
+-- src
|
+-- Book
| +-- History
| | +-- UnitedStates.php - namespace Book\History;
+-- Vehicle
| +-- Air
| | +-- Wings
| | | +-- Airplane.php - namespace Vehicle\Air\Wings;
| +-- Road
| | +-- Car.php - namespace Vehicle\Road;
+-- tests
+-- test.php
+-- vendor
It is deprecated. Looking at vendor/composer/autoload_namespaces.php file you can see the namespaces and the directories that they are mapped to., (*1)
composer.json, (*2)
"autoload": {
"psr-0": {
"Book\\": "src/",
"Vehicle\\": "src/"
}
}
Looking at vendor/composer/autoload_psr4.php file you can see the namespaces and the directories that they are mapped to., (*3)
composer.json, (*4)
"autoload": {
"psr-4": {
"Book\\": "src/",
"Vehicle\\": "src/"
}
}
composer.json, (*5)
"autoload": {
"psr-4": {
"Book\\": "src/Book/",
"Vehicle\\": "src/Vehicle/"
}
}
Just a reminder, before deploying your code in production, don't forget to optimize the autoloader:, (*6)
$ composer dump-autoload --optimize
This can also be used while installing packages with the --optimize-autoloader option. Without that optimization, you may notice a performance loss from 20 to 25%., (*7)
See tests/test.php, (*8)
composer install php tests/test.php
Autoload testing between psr-0 and psr-4