PHPackages                             gorgo/golib - 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. gorgo/golib

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gorgo/golib
===========

shared php tools lib.

0.2.1(5y ago)04451MITPHP 8.\*

Since Sep 14Compare

[ Source](https://github.com/swaros/golib)[ Packagist](https://packagist.org/packages/gorgo/golib)[ Docs](https://github.com/swaros/golib)[ RSS](/packages/gorgo-golib/feed)WikiDiscussions Synced 2w ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (1)

golib
=====

[](#golib)

basic php tools lib. Includes a xpath based Xml Reader and Define some Types like Enums or Propertie Classes

#### Install

[](#install)

you can get this lib via composer `composer require gorgo/golib`

### Enum

[](#enum)

The basic Enum Class provides a easy Way to check against valid Entires. Extends from Enum and define a Array inside the method 'getPossibleValueArray()' that contains all possible values.

```
use golib\Types\Enum;
class MyEnum extends Enum {
   function getPossibleValueArray(){
        return array('a','b','c');
    }
}
```

now simply initiate the new class by using the value that should be used.

```
$myEnum = new MyEnum('b'); // will be accepted
echo $myEnum->geValue();   // 'b'

$exceptionEnum = new MyEnum('g'); // a EnumException will be Trown beause g is not valid

$failEnum = new MyEnum('g',EnumDef::ERROR_MODE_TRIGGER_ERROR); // just triggers an PHP error
```

### ConstEnum

[](#constenum)

this is a Enum that can be used just by adding 'const' like so

```
use golib\Types\ConstEnum;
class MyEnum extends ConstEnum {
  const INTEGER = 1;
  const STRING = 2;
  const ARRAY = 3;
}
```

the usage is the same as Enum but you can use the 'const' what improves the codestyle.

```
$myEnum = new MyEnum(MyEnum::INTEGER); // of course valid
$value = 2;
$myEnum = new MyEnum($value); // also valid because 2 is defined as ARRAY
$myEnum = new MyEnum(6); // will throw a EnumException
$myEnum = new MyEnum(6, EnumDef::ERROR_MODE_TRIGGER_ERROR); // instead of a exception a error is triggered
```

### Props

[](#props)

the `Props` class is the Object oriented way to work with Content that will be provided as Array. For example Database results:

The regular way to work with these looks like so

```
$query = sprintf("SELECT firstname, lastname, address, age FROM friends ");
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
    echo $row['firstname'];
    echo $row['lastname'];
    echo $row['address'];
    echo $row['age'];
}
```

That means youre code depends on the database design. And if you access this data later, for exampel in another class, you have to know about the database structure. Also it will be difficult if on some point the database will be refactored.

`Props` is a Container that forces OOP Style to accessing this data. Like so:

```
use golib\Props;
class Person extends Props {
    public $firstname = NULL;
    public $lastname = NULL;
    public $adress = NULL;
    public $age = NULL;
}
```

the usage looks like over engineered but just shows the different way to acess the data.

```
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
    $person = new Person($row);
    echo $person->firstname;
    echo $person->lastname;
    echo $person->adress;
    echo $person->age;
}
```

All modern IDE's support code completion so the usage of `Props` will help you to get the right propertie.

###  Health Score

27

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~406 days

Total

4

Last Release

2037d ago

PHP version history (2 changes)0.1.1PHP &gt;=5.3.0

0.2.0PHP 8.\*

### Community

Maintainers

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

---

Top Contributors

[![swaros](https://avatars.githubusercontent.com/u/5437750?v=4)](https://github.com/swaros "swaros (30 commits)")

---

Tags

enumpropertiesenums

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gorgo-golib/health.svg)

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

###  Alternatives

[myclabs/php-enum

PHP Enum implementation

2.7k238.8M716](/packages/myclabs-php-enum)[dasprid/enum

PHP 7.1 enum implementation

384173.2M12](/packages/dasprid-enum)[spatie/enum

PHP Enums

85133.9M79](/packages/spatie-enum)[marc-mabe/php-enum

Simple and fast implementation of enumerations with native PHP

49863.5M114](/packages/marc-mabe-php-enum)[spatie/laravel-enum

Laravel Enum support

3655.9M36](/packages/spatie-laravel-enum)[henzeb/enumhancer

Your framework-agnostic Swiss Army knife for PHP 8.1+ native enums

70389.8k2](/packages/henzeb-enumhancer)

PHPackages © 2026

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