These classes are based on a (slightly) improved set of classes and functions that were originally built on CodeAcademy and that we have found extremely useful. They can serve as a basis for not only UserSpice or for your project as a whole.


The Input class is a great way to grab data that is passed to your site, whether by get or post.

$permission = Input::get('name');

Notice that it is a static method and it needs the ::

The most important thing that the Input class does, however is automatically sanitize your data. Sweet. If you’re getting input from a user, use it!



If you copy and paste this code, please get rid of the space before the opening php tag.

class Input {
	public static function exists($type = 'post'){
		switch ($type) {
			case 'post':
				return (!empty($_POST)) ? true : false;

			case 'get':
				return (!empty($_GET)) ? true : false;

				return false;