1. Go to this page and download the library: Download wandersonwhcr/phact 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/ */
wandersonwhcr / phact example snippets
use Phact\Manager;
use Phact\NodeInterface;
use Phalcon\Events\Event;
use Phalcon\Events\Manager as EventsManager;
class A implements NodeInterface
{
public function onExecute(Event $event, NodeInterface $node)
{
if ($node instanceof self) { // or $event->getData() == 'A'
echo "A!";
}
}
}
class B implements NodeInterface
{
public function onBeforeExecute(Event $event, NodeInterface $node)
{
if ($node instanceof A) { // or $event->getData() == 'A'
echo "B before A! ";
}
}
}
$manager = (new Manager())
->setEventsManager(new EventsManager())
->add('A', new A())
->add('B', new B());
$manager->execute('A'); // outputs "B before A! A!"
use Phact\NodeInterface;
use Phalcon\Events\Event;
class Node implements NodeInterface
{
public function onBeforeExecute(Event $event, NodeInterface $node)
{
}
public function onExecute(Event $event, NodeInterface $node)
{
}
public function onAfterExecute(Event $event, NodeInterface $node)
{
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.