I'm currently trying to use PSR-0 autoloading with Composer, but I'm getting the following error:
Fatal error: Class 'Twitter\Twitter' not found
My directory structure looks like this
- Project
- src
- Twitter
Twitter.php
- vendor
- Test
index.php
My index.php file looks like this:
<?php
use Twitter;
$twitter = new Twitter();
My Twitter.php file looks like this
<?php
namespace Twitter;
class Twitter
{
public function __construct()
{
// Code Here
}
}
And finally my composer.json looks like this:
{
"require": {
"phpunit/phpunit": "3.8.*@dev",
"guzzle/guzzle": "3.7.*@dev"
},
"minimum-stability": "dev",
"autoload": {
"psr-0": {
"Twitter" : "src/Twitter"
}
}
}
I am getting a little confused. I come from a C# background and this way of working is kinda confusing me. What's the correct way to use PSR-0 autoloading?