I mean like for everything, for example:
instead of-
// this does a directory scan and returns an array of "Component" objects.
$extensions = get_site_extensions($path);
do this-
$extension_factory = new ComponentCollection($path);
// does the same thing as the function above
$extensions = $extension_factory->getList();
Should I just stick with a simple function?
YAGNI comes to mind. It’s bad practice to write code ‘just in case’. Another way of thinking about it: what problem is your code solving? If the code isn’t immediately getting you closer to your finished app, don’t include it.
You may also want to familiarize yourself with some patterns and anti-patterns to understand what they accomplish and when and why you would (or not) use them.
http://en.wikipedia.org/wiki/Software_design_pattern
http://en.wikipedia.org/wiki/Anti-pattern