johnwatkins0 / wp-singleton
There is no license information available for the latest version (1.0.0) of this package.
A singleton trait for use in WordPress projects
1.0.0
2019-01-13 22:42 UTC
Requires (Dev)
This package is auto-updated.
Last update: 2025-03-11 16:11:39 UTC
README
A singleton trait for use in WordPress projects
Example
use JohnWatkins0\WPSingleton\Singleton; class My_Class { use Singleton; protected function init() { // Do stuff when the object is first created. } } My_Class::get_instance(); // Retrieve an instance. My_Class::get_instance(); // Same instance as above. new My_Class(); // Error.