Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 31 | All time: 11,122 This week: 206 |
Version | License | PHP version | Categories | |||
mezon-singleton 1.0 | MIT/X Consortium ... | 5 | PHP 5, Language, Design Patterns |
Description | Author | |
This class can be used to create object of a class that only has 1 instance. |
This class implements basic singleton pattern.
Using singleton behaviour in your applications is so simple as it can be. Just extend the class Singleton, and enjoy using it!
See the code:
// including all necessary files
require_once( dirname( dirname( dirname( __FILE__ ) ) ).'/conf/conf.php' );
require_once( $MEZON_PATH.'/vendor/singleton/singleton.php' );
// creatingyour own class
class MyClass extends Singleton
{
// methods and their implementations
}
That's all!
You can see the Template Engine class for real usage of this pattern.
Files (5) |
File | Role | Description | ||
---|---|---|---|---|
Tests (1 file) | ||||
composer.json | Data | Auxiliary data | ||
phpunit.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
Singleton.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.