PHP code example of kelemen / observer
1. Go to this page and download the library: Download kelemen/observer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kelemen / observer example snippets
class Foo extends Kelemen\Observer
{
use Kelemen\ObserverBehavior;
public function __construct($bar)
{
$bar->attach($this);
}
public function someFunction()
{
// process
}
}
class Bar extends Kelemen\Observable
{
use Kelemen\ObservableBehavior;
public function __construct()
{
$this->setState('someFunction')
}
}