This project is not covered by Drupal’s security advisory policy.
Description
This module utilizes the Singleton design pattern inspired by petrknap/php-singleton
PHP library through composer. This module is only an API to allow you to utilize singletons
for classes you create and does not provide any UI or CLI.
How to use
In your PHP class
namespace Drupal\my_module;
use Drupal\singleton\Singleton\SingletonInterface;
use Drupal\singleton\Singleton\SingletonTrait;
/**
* Implementation of Singleton design pattern.
*/
class ExampleSingletonClass implements SingletonInterface {
use SingletonTrait;
public function foo() {
return t('bar');
}
}
When you implement this singleton, it would look something like this:
$my_instance = \Drupal\my_module\ExampleSingletonClass::getInstance();
Dependencies
Drupal 7
Project information
Maintenance fixes only
Considered feature-complete by its maintainers.- Project categories: Developer tools
2 sites report using this module
- Created by bribread22 on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
