johnwatkins0 / wp-singleton
A singleton trait for use in WordPress projects
This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.
Installs: 532
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/johnwatkins0/wp-singleton
Requires (Dev)
This package is auto-updated.
Last update: 2025-06-11 16:38:09 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.