PHP Classes


Recommend this page to a friend!
  Classes of Alexey Dodonov   Mezon PHP Singleton Class   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Mezon PHP Singleton Class
Create object of a class that only has 1 instance
Author: By
Last change:
Date: 3 years ago
Size: 689 bytes


Class file image Download



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.