我在GitHub
上有一个简单的作曲家项目,其目录结构为:
/--
-composer.json
-lib/ComposerTest.php
将ComposerTest.php
文件作为:
namespace lib;
class ComposerTest{
public function doTest(){
return "This class was loaded from Composer\n";
}
}
和composer.json
as:
{
"name":"sc/composerTest",
"autoload":{
"psr-0":{
"lib":"./"
}
}
}
使用以下composer.json
文件,我可以将GitHub
项目包含到我的vendor
文件夹中,但无法将其自动加载。
{
"description" : "The CodeIgniter Application with Composer",
"require": {
"php": ">=5.3.2",
"codeigniter/framework": "3.1.*",
"kriswallsmith/buzz":"*",
"maltyxx/bower": "^1.0",
"sc/composerTest":"dev-master"
},
"require-dev": {
"mikey179/vfsStream": "1.1.*"
},
"repositories": [
{
"type": "git",
"url": "https://github.com/sc/composerTest.git"
}
]
}
有人可以提供建议吗?
修改: ComposerTest
控制器
class ComposerTest extends CI_Controller
{
public function index()
{
$composerTest = new ComposerTest();
echo $composerTest->doTest();
}
}