Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chrisnharvey/php-singleton-trait

A quick way to turn any class into a singleton using this trait.
https://github.com/chrisnharvey/php-singleton-trait

Last synced: about 4 hours ago
JSON representation

A quick way to turn any class into a singleton using this trait.

Awesome Lists containing this project

README

        

PHP Singleton Trait
===================

A quick way to turn any class into a singleton using this trait.

## Usage
You can easily turn your classes into singletons. See the following example.

Hello again';
}
}

You can then call any of these functions statically and method chain them as if they were instantiated.

MySingletonClass::helloWorld()->helloAgain();

This would output:

Hello World
Hello again

If you would like to submit changes or pull requests then please feel free.