1. Go to this page and download the library: Download hbroker91/php-hookifier 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/ */
hbroker91 / php-hookifier example snippets
namespace Some\Namespace;
use Hbroker91\PHPHookifier\Hookable;
class UserModel extends Model implements Hookable {
/** @var string */
private $userName;
/** @var string */
private $userId;
/** @var string */
private $emailAddress;
...
// if the func. evaluates to false, throw an Exception somewhere at application's boot
// otherwise allow this class to instantiate and potentially fill up with data
// (in this case this class represents a model).
public static function beforeConstruct(... $options): bool
{
[$payload] = $options;
return isset($payload['userData']));
}
public static function afterDestroy(... $options): bool
{
// do some very important thing
// if it went ok, return true otherwise false
return true;
}
}
namespace Some\Namespace;
use Hbroker91\PHPHookifier\Hookify;
class UserModel extends Model {
use Hookify;
/** @var string */
private $userName;
/** @var string */
private $userId;
/** @var string */
private $emailAddress;
...
// if the func. evaluates to false, throw an Exception somewhere at application's boot
// otherwise allow this class to instantiate and potentially fill up with data
// (in this case this class represents a model).
public static function beforeConstruct(... $options): bool
{
[$payload] = $options;
return isset($payload['userData']));
}
public static function afterDestroy(... $options): bool {}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.