I do something similar to what Shrike suggested, except I don't make it a singleton. I certainly don't wrap every PHP function though, and usually do not just wrap a single function unless I know it something that is going to be trumped later on (such as mb_string when PHP 6 arrives) or usually want defaults that differ from the PHP defaults. Normally though, I just create them for utility functions that PHP doesn't offer a built in function for, or for a common series of function calls that occur throughout the application, such as saving a file where you generally want to save it and chmod it to an appropriate value.
My approach looks like this:
class Foo {
public static function utils($name, $input = null) {
$class = $name . 'Util';
$util = new $class($input);
return $util;
}
}
class StringUtil {
protected $string;
public function __construct($string = null) {
$this->string = $string;
}
public function toUpper() {
return mb_strtoupper($this->string, 'UTF-8');
}
}
Foo::utils('String', 'bar båzzle')->toUpper();
I like it because it is easy to expand upon. Though it is coded so the utility constructor only can get a single parameter, this could be changed, but I haven't yet found a need to do so. So far it has made more sense to pass extra parameters into the method when needed.