Make namespaces much more explicit
parent
2e25a9298d
commit
95b2ddb33e
|
@ -366,6 +366,10 @@ classes).
|
||||||
Under the `psr-0` key you define a mapping from namespaces to paths, relative to the
|
Under the `psr-0` key you define a mapping from namespaces to paths, relative to the
|
||||||
package root. Note that this also supports the PEAR-style non-namespaced convention.
|
package root. Note that this also supports the PEAR-style non-namespaced convention.
|
||||||
|
|
||||||
|
Please note namespace declarations should end in `\\` to make sure the autoloader
|
||||||
|
responds extactly. For example `Foo` would match in `FooBar` so the traling
|
||||||
|
backslashes solve the problem: `Foo\\` and `FooBar\\` are distinct.
|
||||||
|
|
||||||
The PSR-0 references are all combined, during install/update, into a single key => value
|
The PSR-0 references are all combined, during install/update, into a single key => value
|
||||||
array which may be found in the generated file `vendor/composer/autoload_namespaces.php`.
|
array which may be found in the generated file `vendor/composer/autoload_namespaces.php`.
|
||||||
|
|
||||||
|
@ -374,7 +378,7 @@ Example:
|
||||||
{
|
{
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
"Monolog": "src/",
|
"Monolog\\": "src/",
|
||||||
"Vendor\\Namespace\\": "src/",
|
"Vendor\\Namespace\\": "src/",
|
||||||
"Vendor_Namespace_": "src/"
|
"Vendor_Namespace_": "src/"
|
||||||
}
|
}
|
||||||
|
@ -386,7 +390,7 @@ you can specify them as an array as such:
|
||||||
|
|
||||||
{
|
{
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": { "Monolog": ["src/", "lib/"] }
|
"psr-0": { "Monolog\\": ["src/", "lib/"] }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +481,7 @@ To do that, `autoload` and `target-dir` are defined as follows:
|
||||||
|
|
||||||
{
|
{
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": { "Symfony\\Component\\Yaml": "" }
|
"psr-0": { "Symfony\\Component\\Yaml\\": "" }
|
||||||
},
|
},
|
||||||
"target-dir": "Symfony/Component/Yaml"
|
"target-dir": "Symfony/Component/Yaml"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue