PHP Classes
elePHPant
Icontem

Singleton Trait: Trait that adds singleton pattern to a class

Recommend this page to a friend!
  Info   View files Example   View files View files (15)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2016-07-10 (3 years ago) RSS 2.0 feedNot enough user ratingsTotal: 244 All time: 7,797 This week: 369Up
Version License PHP version Categories
singleton-trait 3.2MIT/X Consortium ...5.4PHP 5, Language, Design Patterns, Traits
Description Author

This is a trait that adds singleton pattern to a class.

The trait can allow the creation of the first object of the class taking optional configuration parameters.

Classes that use the trait may override the init() method to process the parameters that may be restricted to the first instantiation of the object.

  Performance   Level  
Name: Asher Wolfstein <contact>
Classes: 15 packages by
Country: United States United States
Age: 36
All time rank: 1125149 in United States United States
Week rank: 784 Up76 in United States United States Up
Innovation award
Innovation award
Nominee: 5x

 

  Files folder image Files  
File Role Description
Files folder imageFalcraft (1 directory)
Files folder imagesrc (1 directory)
Files folder imagetests (1 directory)
Accessible without login Plain text file composer.json Conf. Composer File
Accessible without login Plain text file LICENSE.txt Lic. License (MIT)
Accessible without login Plain text file phpunit.xml Test Unit Testing
Accessible without login Plain text file README.txt Doc. README

  Files folder image Files  /  Falcraft  
File Role Description
Files folder imagePatterns (2 files, 2 directories)

  Files folder image Files  /  Falcraft  /  Patterns  
File Role Description
Files folder imageException (2 files)
Files folder imageResource (1 file)
  Accessible without login Plain text file SingletonExampleAndTest.php Example A registry singleton example
  Plain text file SingletonTrait.php Class The Singleton Trait

  Files folder image Files  /  Falcraft  /  Patterns  /  Exception  
File Role Description
  Plain text file ExceptionInterface.php Class Custom/Local Exception Interface
  Plain text file RuntimeException.php Class Custom/Local Runtime Exception

  Files folder image Files  /  Falcraft  /  Patterns  /  Resource  
File Role Description
  Plain text file SingletonInterface.php Class An interface to identify singletons, separate from trait

  Files folder image Files  /  src  
File Role Description
Files folder imagePhabstractic (1 file, 1 directory)

  Files folder image Files  /  src  /  Phabstractic  
File Role Description
Files folder imagePatterns (2 directories)
  Accessible without login Plain text file falcraftLoad.php Conf. Loader

  Files folder image Files  /  src  /  Phabstractic  /  Patterns  
File Role Description
Files folder imageException (2 files)
Files folder imageResource (2 files)

  Files folder image Files  /  src  /  Phabstractic  /  Patterns  /  Exception  
File Role Description
  Plain text file ExceptionInterface.php Class exception classification
  Plain text file RuntimeException.php Class exception classification

  Files folder image Files  /  src  /  Phabstractic  /  Patterns  /  Resource  
File Role Description
  Plain text file SingletonInterface.php Class Main Trait
  Plain text file SingletonTrait.php Class Main Trait

  Files folder image Files  /  tests  
File Role Description
Files folder imagePhabstractic (1 directory)

  Files folder image Files  /  tests  /  Phabstractic  
File Role Description
Files folder imagePatterns (1 directory)

  Files folder image Files  /  tests  /  Phabstractic  /  Patterns  
File Role Description
Files folder imageResource (1 file)

  Files folder image Files  /  tests  /  Phabstractic  /  Patterns  /  Resource  
File Role Description
  Accessible without login Plain text file SingletonTrait.php Test unit testing

 Version Control Reuses Unique User Downloads Download Rankings  
 0%1
Total:244
This week:0
All time:7,797
This week:369Up