/** * Hash a string * * @param string $string Plain text string. * * @return bool|string Returns the hash, or FALSE on failure. */ function zHash($string) { return password_hash($string, \ZigiPhp\App::getConfig('hash')['algo'], \ZigiPhp\App::getConfig('hash')['options']); }
<?php /** * RedBean service provider * @return \RedBeanPHP\ToolBox */ use ZigiPhp\App; return function () { return \RedBeanPHP\R::setup(App::getConfig('redbean')['dsn'], App::getConfig('redbean')['username'], App::getConfig('redbean')['password'], App::getConfig('redbean')['frozen']); };
<?php /** * Blade service provider * @return \Philo\Blade\Blade */ use ZigiPhp\App; return function () { $blade = new \Philo\Blade\Blade(App::getConfig('blade')['viewPath'], App::getConfig('blade')['cachePath']); $blade->getCompiler()->directive('trans', function ($expression) { return '<?php echo \\ZigiPhp\\Helpers\\I18n::__' . $expression . '; ?>'; }); $blade->getCompiler()->directive('form', function ($expression) { return '<?php ob_start(); ?>'; }); $blade->getCompiler()->directive('endform', function () { return '<?php \\ZigiPhp\\Helpers\\Form::create(ob_get_clean()); ?>'; }); return $blade; };
<?php /** * @return PHPMailer */ return function () { $mailer = new \PHPMailer(); if (isset(\ZigiPhp\App::getConfig('mail')['type'])) { switch (\ZigiPhp\App::getConfig('mail')['type']) { case 'sendmail': $mailer->isSendmail(); break; case 'qmail': $mailer->isQmail(); break; case 'smtp': $mailer->isSMTP(); if (isset(\ZigiPhp\App::getConfig('mail')['options'])) { foreach (\ZigiPhp\App::getConfig('mail')['options'] as $option => $value) { $mailer->{$option} = $value; } } break; } } return $mailer; };