mysociety/theyworkforyou — pull request #643 by jacksonj04 (2014-08-11 15:57:29+00:00)
Title: WIP: Refactoring: Autoloading

Move classes and supporting functions which are currently being included into classes which are discoverable by the Composer autoloader (using the [PSR-4 autoloader specification](http://www.php-fig.org/psr/psr-4/)). These classes will only be loaded when actually required.

#### Wait, isn't this just a lot of unnecessary change for the sake of change?

No – at the moment there are loads of functions and classes which are sat in files throughout the TWFY folder structure. These are only made available to the code if the file is included (via either `include` or `require` or their variants). This can lead to exciting maintainability problems since it's not clear where any piece of functionality has actually arisen.

#### Will this change how things behave?

No. There should be no functional changes in the site at all, and if there are any then this refactoring hasn't gone at all as planned.

#### Will this slow things down?

[No](https://athos.blogs.balabit.com/2011/03/php-autoload-performance/). It might even speed things up since we won't be loading a lot of functionality which is never used.

#### Why wasn't TWFY written like this to start with? There must be a good reason!

When TWFY was written PHP didn't support proper OOP, namespaces or autoloading. It now does, and we've dropped support (as of 0dcdd86b488d3b75ebb14f64b8fd316b03c63746) for anything below PHP 5.4.