내 app 라이브러리를 추가하기 위해 app 폴더에 라이브러리 폴더를 만들었습니다. 나는 폴더를 자동로드에 응용 프로그램 구성 파일 및 composer.json을 업데이트했지만, 내가 명령 composer dump-autoload
을 실행할 때 다음 오류 얻을 :laravel 4에서 'libraries'를 자동로드하는 방법은 무엇입니까?
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'App\\Libraries\\Search\\SearchServiceProvider' not found","file":"D:\\Users\\Miguel Borges\\Documents\\Trabalhos\\Tese\\portal\\bootstrap\\compiled.php","line":4130}}PHP Fatal error: Class 'App\Libraries\Search\SearchServiceProvider' not found in D:\Users\Miguel Borges\Documents\Trabalhos\Tese\portal\bootstrap\compiled.php on line 4130 [Finished in 1.1s with exit code 255]
내 응용 프로그램 폴더 트리 :
app
| ...
+ libraries
| + search
| | - Search.php
| | - SearchFacade.php
| | - SearchServiceProvider.php
| + lib2
| | - ...
| + lib3
| | - ...
| | - Theme.php
| - ...
- filters.php
- routes.php
을 SearchServiceProvider.php
namespace App\Libraries\Search;
use Illuminate\Support\ServiceProvider;
class SearchServiceProvider extends ServiceProvider {
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app['search'] = $this->app->share(function($app)
{
return new Search;
});
}
}
composer.js 기본적으로
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/libraries",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
// ,
// "psr-0": {
// "app": "app/libraries"
// }
},
에, 나는 자동로드에 '라이브러리'폴더 내의 모든 라이브러리가 필요합니다.
''app/libraries ''를 클래스 맵 섹션에 추가 할 수 있습니까? –
이 아니라면, classmap의 폴더는 하위 폴더가 아닌 루트에있는 파일 만로드합니다. 귀하의 회신에 대해 –