PHPackages                             gabbro-php/base - 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. gabbro-php/base

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

gabbro-php/base
===============

Foundational collection of tools

1.006681(7mo ago)005MITPHPPHP &gt;=8.0.0

Since Sep 22Pushed 7mo agoCompare

[ Source](https://github.com/gabbro-php/base)[ Packagist](https://packagist.org/packages/gabbro-php/base)[ RSS](/packages/gabbro-php-base/feed)WikiDiscussions gh-main Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (5)

[![logo/logo-banner.png](https://github.com/gabbro-php/base/raw/gh-main/logo/Logo-banner.png)](https://github.com/gabbro-php/base/blob/gh-main/logo/Logo-banner.png)

[![PHP Version](https://camo.githubusercontent.com/ee919d4a8717eb9b27bcb6f166882995dcde6bed26da505fe29a07be287a9e31/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382d626c75653f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/ee919d4a8717eb9b27bcb6f166882995dcde6bed26da505fe29a07be287a9e31/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382d626c75653f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)

**Gabbro** is a lightweight PHP utility library that provides a solid foundation of tools for building applications. It focuses on core abstractions and practical helpers — the kind of building blocks you reach for again and again — wrapped in a consistent, modern API.

---

✨ Features
----------

[](#-features)

- **Strong Type Safety**
    Designed to work seamlessly with PHPStan / Psalm for **compile-time safety**
- **Collections**
    Immutable and mutable collection types for working with data:

    - `KeyTable`, `Map`, `ArrayList`, `HashSet`
    - Immutable interfaces for safe sharing between components
- **Streams**
    Stream abstractions for handling input/output, iteration, and buffering.
- **Shell**
    Quickly execute shell commands and work with interactive shells. Built-in support for stream selection and makes use of the Stream library.
- **Class loading**
    Utility class loaders and autoload helpers that follow modern PSR standards.
- **CLI argument parsing**
    `ArgV` provides a clean way to parse command-line input into **flags, options, and operands**, with support for GNU style options.
- **Flat-file configuration parsing**
    `FlatFileScanner` reads simple, Unix-style config files with comments, whitespace, escaping, and quoted values.
- **Core utilities**
    Handy helpers for type conversion (`toBoolean`, `toNumber`, `toString`), version handling, validation, and more.

---

📌 Philosophy
------------

[](#-philosophy)

- **Small, composable classes** → each tool does one thing well.
- **Strong static typing** → every class and method is designed with generics and docblocks for static analyzers.
- **Consistent API surface** → all streams, collections and parsers behave the same way.
- **Foundation, not framework** → no hidden magic, just reusable bricks.

---

🚀 Example
---------

[](#-example)

```
$arg = new stdClass();
$arg->Parser = new ArgV($argv);

$arg->Parser->parseAll(
    $arg->help = Flag::withDescription(
            "Show this help section.",
            "--help", "-h"
    ),

    $arg->debug = Flag::withDescription(
            "Create a debug output.",
            "--debug"
    ),

    $arg->name = Option::withDescription(
            "NAME",
            "Set the output name.",
            "--name"
    ),

    $arg->dirs = ArrayOption::withDescription(
            "PATH",
            "Add one or more directories.",
            "--dir"
    )

    $arg->dirs = Operand::withDescription(
            "Action",
            "Perform action such as Action1 and Action2.",
            0
    )
);

if ($arg->help->isSet() || !$arg->Parser->isConsumed()) {
    echo $arg->Parser->buildHelp("Usage: ". $arg->Parser->cmd ."  Action");
    exit;
}
```

Output:

```
Usage: MyScript.php  Action

Options:
  --help, -h        Show this help section.
  --debug           Create a debug output.
  --name NAME       Set the output name.
  --dir[] PATH      Add one or more directories.

Operands:
  Action            Perform action such as Action1 and Action2.

```

---

📦 Installation
--------------

[](#-installation)

Install via [Composer](https://getcomposer.org/):

```
composer require gabbro-php/base
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance63

Regular maintenance activity

Popularity0

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity43

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 ~5 days

Total

4

Last Release

224d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ecf19012ac8ad546408e9ca1666b479831b495dc947b263987509a75acd7524b?d=identicon)[dbergloev](/maintainers/dbergloev)

---

Top Contributors

[![dbergloev](https://avatars.githubusercontent.com/u/1395583?v=4)](https://github.com/dbergloev "dbergloev (21 commits)")

### Embed Badge

![Health badge](/badges/gabbro-php-base/health.svg)

```
[![Health](https://phpackages.com/badges/gabbro-php-base/health.svg)](https://phpackages.com/packages/gabbro-php-base)
```

PHPackages © 2026

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