PHP code example of deli13 / loader

1. Go to this page and download the library: Download deli13/loader 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/ */

    

deli13 / loader example snippets



deli13\Loader\Loader;
use ParagonIE\EasyDB\Factory;

function app()
{
    return Loader::getInstance();
}

/**
 * Указание базовой директории
 */
app()->setBaseDir(dirname(__FILE__));
/**
 * Установка подключения
 */
$connection = Factory::create("mysql:host=127.0.0.1;dbname=admindb", "root", "1234");
app()->setConnection($connection);
$all_action = app()->getConnection()->run("select * from t_action");


/**
 * Задание почты через sendmail
 */
app()->mailer()->isSendmail()->setFrom(["[email protected]" => "Тестовый ящик"]);
/**
 * Задание почты через smtp
 */
app()
    ->mailer()
    ->isSMTP([
        "host" => "xxx.xx",
        "username" => "test",
        "password" => "xxx",
        "port" => 587,
        "secure" => "tls"
    ]);
/**
 * Запуск безопасного обработчика
 * с логированием на почту в случае ошибки
 */
app()->startSaveRunner(function () {
    throw new Exception("Тест");
}, true);