1. Go to this page and download the library: Download proteins/event 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/ */
proteins / event example snippets
use Proteins\Event;
use Proteins\Events;
class MyClass {
use Events;
}
Event::on('eat',function($who,$what,$where){
echo "$who ate a $what, in the $where.";
});
Event::trigger('eat','Simon','Burrito','Kitchen');
// Result : Simon ate a Burrito, in the Kitchen
class Game {
use Events;
public static function loadLevel($name){
...
self::trigger("level.loaded", $name);
}
}
Game::on("level.start",function($level_name){
echo "Starting {$level_name}, BRING'EM'ON!!!\n";
});
Game::on("level.loaded",function($level_name){
echo "Reticulating splines for {$level_name}...\n";
Game::trigger("level.start", $level_name);
});
Game::on("level.start",function($level_name){
echo "Replenish ammonitions...\n";
});
Game::loadLevel("E1M1");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.