You should create a top-level namespace for your application.
Then put all libraries you code under that namespace. Note: Any third-party libraries should (hopefully) be installed via Composer and therefore have its own namespace/autoloading setup.
Your directory structure would then be:
libraries
Myapp
Search (note directory is capitalized)
Search.php
SearchFacade.php
SearchServiceProvider.php
AnotherLib
Then your classes will follow that namespace:
File: Myapp/Search/Search.php
:
<?php namespace MyappSearch;
class Search { ... }
And finally, your autoloading setup:
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/libraries",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
,
"psr-0": {
"Myapp": "app/libraries"
}
},
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…