Helpful code snippets and classes (PHP)