PHP Classes
PHP Classes
elePHPant
Icontem

Notable PHP package: Arsenal PHP Singleton Trait

Recommend this page to a friend!
  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog Notable PHP package: ...   Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)  

Author:

Updated on: 2020-02-26

Posted on:

Categories: Notable Packages

Singleton is a common design pattern used by many developers to assure that only one object of a class is created even if the software tries to create objects of that class more than once.

This package provides an alternative approach to assure that only one object of a class is created by using PHP constant values to keep track of the objects that are created.

Read this article to learn more details about how this notable PHP package works.


 



The package Arsenal PHP Singleton Trait is one of the few PHP packages that was considered notable recently because it does something that is worth paying attention.

The basic purpose is: Trait to make classes only have singleton objects

Here follows in more detail what it does:

This package provides a trait to make classes only have singleton objects.

The trait provides a getter function that initializes an object on the first time a variable of the class is accessed with an instance of the target object that will act as a singleton object for the class.

A setter function will assign the variables of the target object that acts as singleton object for that class.

A constant array can be used to define how to map classes to target classes that will have objects acting as singletons.

Notable PHP packages can be often considered innovative. If this package is also innovative, it can be nominated to the PHP Innovation Award and the author may win prizes and recognition for sharing innovative packages.

If you also developed your own notable or innovative packages consider sharing them, so you can also earn more visibility for your package.



You need to be a registered user or login to post a comment

Login Immediately with your account on:

FacebookGmail
HotmailStackOverflow
GitHubYahoo


Comments:

No comments were submitted yet.




  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog Notable PHP package: ...   Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)