PHPackages                             godsdev/backyard - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. godsdev/backyard

Abandoned → [workofstan/backyard](/?search=workofstan%2Fbackyard)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

godsdev/backyard
================

Library of useful functions and classes

v3.2.10(5y ago)01.6k21MITPHPPHP &gt;=5.3.0

Since Nov 17Pushed 5y ago2 watchersCompare

[ Source](https://github.com/GodsDev/backyard)[ Packagist](https://packagist.org/packages/godsdev/backyard)[ Docs](https://github.com/GodsDev/backyard)[ RSS](/packages/godsdev-backyard/feed)WikiDiscussions develop Synced 4w ago

READMEChangelog (10)Dependencies (2)Versions (31)Used By (1)

Library In Backyard
===================

[](#library-in-backyard)

ABANDONED - use [workofstan/backyard](https://github.com/WorkOfStan/backyard) instead, where it is actively maintained.

**Collection of useful functions**

[![Total Downloads](https://camo.githubusercontent.com/3762024b14841492d2f970cb8d5ef6f83d9d99203fee105502389b4a35f7db5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676f64736465762f6261636b796172642e737667)](https://packagist.org/packages/godsdev/backyard)[![Latest Stable Version](https://camo.githubusercontent.com/6867c666c8fc632405e9170eb4e7b9cdcc4c46f0912c05a49f5bc5961efc3b5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676f64736465762f6261636b796172642e737667)](https://packagist.org/packages/godsdev/backyard)[![Lint Code Base](https://github.com/GodsDev/backyard/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/GodsDev/backyard/actions?query=workflow%3A%22Lint+Code+Base%22)[![PHP Composer + PHPUnit](https://github.com/GodsDev/backyard/workflows/PHP%20Composer%20+%20PHPUnit/badge.svg)](https://github.com/GodsDev/backyard/actions?query=workflow%3A%22PHP+Composer+%2B+PHPUnit%22)

Requirements
------------

[](#requirements)

- [PHP 5.3.0 or higher](http://www.php.net/) (i.e. not used \[\] instead of array() as this short syntax can be used only since PHP 5.4)

Installation
------------

[](#installation)

You can use **Composer** or simply **Download the Release**

### Composer

[](#composer)

The preferred method is via [composer](https://getcomposer.org). Follow the [installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have composer installed.

Once composer is installed, execute the following command in your project root to install this library:

```
composer require godsdev/backyard:^3.2.10
```

Finally, be sure to include the autoloader:

```
require_once '/path/to/your-project/vendor/autoload.php';
```

### Download the Release

[](#download-the-release)

If you abhor using composer, you can download the package in its entirety. The [Releases](https://github.com/godsdev/backyard/releases) page lists all stable versions. Download any file with the name `backyard-[RELEASE_NAME].zip` for a package including this library and its dependencies.

Uncompress the zip file you download, and include the autoloader in your project:

```
require_once '/path/to/backyard/vendor/autoload.php';
```

Deployment
----------

[](#deployment)

After the autoloader is included you may create the `backyard` object with default configuration:

```
$backyard = new \GodsDev\Backyard\Backyard();
```

Or you may configure it with following options:

```
$backyard = new \GodsDev\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 = "rejthar@gods.cz";//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_standard_output'       => false,   //true, pokud má zároveň vypisovat na obrazovku; false, pokud má vypisovat jen do logu
        '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
        'error_hacked'              => true,    //ERROR_HACK parameter is reflected
        'error_hack_from_get'       => 0,       //in this field, the value of $_GET['ERROR_HACK'] shall be set below

        //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
    )
);
```

Notes
-----

[](#notes)

NB: BackyardMysqli creates no Backyard-&gt;Mysqli object (as e.g. Backyard-&gt;Json does) because it is not used by LIB itself and more importantly user of LIB may create any number of those. Example of usage:

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

class BackyardBriefApiClient
----------------------------

[](#class-backyardbriefapiclient)

Very simple JSON RESTful API client. It just sends JSON and returns what is to be returned with few optional decorators and error logging.

- `sendJsonLoad` - sends JSON and returns whatever is returned with second OPTIONAL parameter with HTTP verb `GET`,`PUT`,`DELETE`
- `getJsonArray` - sends JSON and returns array decoded from response JSON
- `getArrayArray` - encode array to a JSON and returns array decoded from response JSON

About previous versions
-----------------------

[](#about-previous-versions)

*Their code is disabled and therefore secured.*

### backyard 1 usage

[](#backyard-1-usage)

This array MUST be created by the application before invoking backyard 1

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

Invoking backyard 1

```
require_once __DIR__ . '/lib/backyard/deploy/functions.php';
```

### backyard 2 usage

[](#backyard-2-usage)

The array $backyardDatabase (see above) SHOULD be created ONLY IF there is a table `system` (or different name stated in $backyardDatabase\['system\_table\_name'\]) with fields containing backyard system info.

Usage:

```
require_once __DIR__ . '/lib/backyard/src/backyard_system.php';
```

Requires the basic LIB library. All other LIB components to be included by

```
require_once (__BACKYARDROOT__."/backyard_XXX.php");
```

**Recommendation**

To be in control of the logging, set following before requiring LIB

```
$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']    = 'your@e-mail.address';   //fatal error are announced to this e-mail
```

Once your application is *production ready*, set following before requiring LIB

```
$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
```

src/emulator.php get\_data in a defined manner (@TODO - better describe)

src/emulate.php is an envelope for emulator.php

Geolocation functions described in src/backyard\_geo.php . Expected structure of geo related tables is in sql/poi.sql .

### Naming conventions (2013-05-04)

[](#naming-conventions-2013-05-04)

1. Naming conventions
    - I try to produce long, self-explaining method names.
    - Comments formatted as Phpdoc, JSDoc
    - I prefer to tag the variable type. I write rather entityA (array of entities) than simple entities. For an instance of song object, rather than song I name the variable songO.
    - Some examples:
        - variable, method, function, elementId – camelCase
        - class name – UpperCamelCase
        - url – hyphened-text
        - file, database\_column, database\_table – underscored\_text
        - constant – BIG\_LETTERS
2. Comments
    - Primary language of comments is English.
    - Deprecated or obsolete code blocks are commented with prefix of the letter “x”. I may add reason for making the code obsolete as in the following:
    - //Xhe’s got id from the beginning: $\_SESSION\["id"\] = User::$himself-&gt;getId();

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 95.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~90 days

Recently: every ~78 days

Total

25

Last Release

2069d ago

Major Versions

1.0 → v2.0.02015-11-19

v2.0.2 → v3.0.02016-07-03

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2787653?v=4)[GodsDev](/maintainers/GodsDev)[@GodsDev](https://github.com/GodsDev)

---

Top Contributors

[![GodsDev](https://avatars.githubusercontent.com/u/2787653?v=4)](https://github.com/GodsDev "GodsDev (213 commits)")[![WorkOfStan](https://avatars.githubusercontent.com/u/26247074?v=4)](https://github.com/WorkOfStan "WorkOfStan (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/godsdev-backyard/health.svg)

```
[![Health](https://phpackages.com/badges/godsdev-backyard/health.svg)](https://phpackages.com/packages/godsdev-backyard)
```

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k196.2M3.0k](/packages/composer-composer)[symfony/lock

Creates and manages locks, a mechanism to provide exclusive access to a shared resource

514139.2M641](/packages/symfony-lock)[phpro/soap-client

A general purpose SoapClient library

8895.9M53](/packages/phpro-soap-client)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k44](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751284.3k37](/packages/civicrm-civicrm-core)[logiscape/mcp-sdk-php

Model Context Protocol SDK for PHP

368116.8k12](/packages/logiscape-mcp-sdk-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
