我正在使用laravel4,这是我的composer.json文件......
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.1.*",
"iron-io/iron_mq": "1.5.1"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"psr-4": {
"iw\\" : "app/iw"
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
但它没有添加iw //到vendor / autoload_ps4.php并显示以下....
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
);
现在它如何在没有在composer.json中引用它的情况下显示Monolog ...
我尝试过运行命令composer update
和composer dump
。真的需要你的帮助来解决这个问题。感谢
答案 0 :(得分:4)
psr-4需要在自动加载中。
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
],
"psr-4": {
"iw\\" : "app/iw"
},
},
答案 1 :(得分:0)
Laravel需要Monolog,所以它会被包含在你的项目中。
您的项目所依赖的每个程序包以及您通过composer.json
文件包含的程序包可能包含其依赖的其他程序包。这些文件也会下载到您的vendors
文件夹中,并包含在您的自动加载文件中。