Reorganize code to use PSR-4 / use proper exceptions

This pull request has two parts:

1. I've eliminated the integer return code "exceptions" in favour of raising true `Exception`s.
2. I've refactored a bit to take advantage of [PSR-4 autoloading](http://www.php-fig.org/psr/psr-0/) using [Composer](http://getcomposer.org).