Skip to content

Instantly share code, notes, and snippets.

@kanian
Last active March 23, 2019 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanian/432abe4d20e426df2f7b30888fb29b48 to your computer and use it in GitHub Desktop.
Save kanian/432abe4d20e426df2f7b30888fb29b48 to your computer and use it in GitHub Desktop.
Singleton use example
<?php
require "./vendor/autoload.php";
use Assoa\Yo\Yo;
use Assoa\Loader\Loader;
use Assoa\PatternFactories\SingletonFactory;
Loader::setLoader(require ("./vendor/autoload.php"));
$singletonClass = SingletonFactory::get(new Yo, true);
$single = new $singletonClass();
$single->hein("Yedi!");
$single->what();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment