PHP code example of workofstan / backyard

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

    

workofstan / backyard example snippets






$backyard = new \WorkOfStan\Backyard\Backyard();

$backyard = new \WorkOfStan\Backyard\Backyard(
    array(//default values
        //logger relevant that SHOULD be configured
        'logging_level'             => 5,       //log up to the level set here, default=5 = debug//logovat az do urovne zde uvedene: 0=unknown/default_call 1=fatal 2=error 3=warning 4=info 5=debug/default_setting 6=speed  //aby se zalogovala alespoň missing db musí být logování nejníže defaultně na 1 //1 as default for writing the missing db at least to the standard ErrorLog
        'mail_for_admin_enabled'    => false,   //fatal error may just be written in log //$backyardMailForAdminEnabled = "[email protected]";//on production, it is however recommended to set an e-mail, where to announce fatal errors
        'error_log_message_type'    => 0,       //parameter message_type http://cz2.php.net/manual/en/function.error-log.php for my_error_log; default is 0, i.e. to send message to PHP's system logger; recommended is however 3, i.e. append to the file destination set either in field $this->BackyardConf['logging_file or in table system
        'logging_file'              => '',      //soubor, do kterého má my_error_log() zapisovat

        //logger relevant other
        'logging_level_name'        => array(0 => 'unknown', 1 => 'fatal', 'error', 'warning', 'info', 'debug', 'speed'),
        'logging_level_page_speed'  => 5,       //úroveň logování, do které má být zapisována rychlost vygenerování stránky
        'die_graciously_verbose'    => true,    //show details by die_graciously() on screen (it is always in the error_log); on production it is recomended to be set to to false due security
        'log_monthly_rotation'      => true,    //true, pokud má být přípona .log.Y-m.log (výhodou je měsíční rotace); false, pokud má být jen .log (výhodou je sekvenční zápis chyb přes my_error_log a jiných PHP chyb)
        'log_profiling_step'        => false,   //110812, my_error_log neprofiluje rychlost //$PROFILING_STEP = 0.008;//110812, my_error_log profiluje čas mezi dvěma měřenými body vyšší než udaná hodnota sec

        //geo relevant
        'geo_rough_distance_limit' => 1, //float //to quickly get rid off too distant POIs; 1 ~ 100km
        'geo_maximum_meters_from_poi' => 2500, //float //distance considered to be overlapping with the device position // 2500 m is considered exact location due to mobile phone GPS caching
        'geo_poi_list_table_name' => 'poi_list', //string //name of table with POI coordinates
    )
);

$backyard = new WorkOfStan\Backyard\Backyard(array('logging_level' => 3));
$logger = $backyard->BackyardError;
$dbLink = new WorkOfStan\Backyard\BackyardMysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE, $logger);

$backyardDatabase = array(
    'dbhost' => 'localhost',
    'dbuser' => 'user',
    'dbpass' => '',
    'dbname' => 'default',
);







$backyardConf['logging_level'] = 3;         //so that only fatal, error, warning are logged
$backyardConf['error_log_message_type'] = 3;//so that logging does not go to PHP system logger but to the monthly rotated file specified on the next line
$backyardConf['logging_file'] = '/var/www/www.alfa.gods.cz/logs/error_php.log';
$backyardConf['mail_for_admin_enabled']    = '[email protected]';   //fatal error are announced to this e-mail

$backyardConf['die_graciously_verbose'] = false;    //so that description contained within die_graciously() is not revealed on screen
$backyardConf['error_hacked']           = false;    //so that *ERROR_HACK* GET parameter is ignored (and 3rd party can't *debug* your application