Static class initializer in PHP
Sounds like you’d be better served by a singleton rather than a bunch of static methods class Singleton { /** * * @var Singleton */ private static $instance; private function __construct() { // Your “heavy” initialization stuff here } public static function getInstance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); … Read more