PHPackages                             oihana/php-system - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. oihana/php-system

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

oihana/php-system
=================

The Oihana PHP System library

0.1.0(1mo ago)08338MPL-2.0PHPPHP &gt;=8.4CI passing

Since Aug 13Pushed 2w agoCompare

[ Source](https://github.com/BcommeBois/oihana-php-system)[ Packagist](https://packagist.org/packages/oihana/php-system)[ Docs](https://github.com/BcommeBois/oihana-php-system)[ RSS](/packages/oihana-php-system/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (49)Versions (5)Used By (8)

Oihana PHP - System
===================

[](#oihana-php---system)

[![Oihana PHP System](https://raw.githubusercontent.com/BcommeBois/oihana-php-system/main/assets/images/oihana-php-system-logo-inline-512x160.png)](https://raw.githubusercontent.com/BcommeBois/oihana-php-system/main/assets/images/oihana-php-system-logo-inline-512x160.png)

Provides a standard set of PHP helpers and tools to create web and command-line applications.

[![Latest Version](https://camo.githubusercontent.com/d44b96690b260a706fa196083995e33996a25246b02a2f03ea8b5ee793bfb6fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6968616e612f7068702d73797374656d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oihana/php-system)
[![Total Downloads](https://camo.githubusercontent.com/112e3e088152b9c7e897560899aa90354797e66a77b5d41417781f962b6c6b9c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6968616e612f7068702d73797374656d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oihana/php-system)
[![License](https://camo.githubusercontent.com/324526be39497079d2e92a7ad8ee4c0fc24c36d44e4413056e428a218107ef88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f6968616e612f7068702d73797374656d2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

📚 Documentation
---------------

[](#-documentation)

Full project documentation is available at:
👉

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

[](#-installation)

> Requires [PHP 8.4+](https://php.net/releases/) and ext-pdo

Install via Composer:

```
```

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

[](#-features)

- Bootstrap helpers: initialize timezone, memory limit, error handling, and safe `ini_set` helpers
- Configuration: load TOML configuration files with sensible fallbacks
- Dependency Injection: convenience functions for building a PHP-DI container and loading definitions
- Logging: PSR-3 compatible lightweight file logger, plus Monolog config enums
- HTTP helpers: constants for methods, headers and parameter strategies
- Date utilities: `TimeInterval` to parse, format and convert durations

🚀 Quick start
-------------

[](#-quick-start)

```
require __DIR__ . '/vendor/autoload.php';

use function oihana\init\{ initDefaultTimezone, initMemoryLimit, initErrors, initConfig, initDefinitions, initContainer };
use oihana\logging\Logger;

// Bootstrap
initDefaultTimezone('UTC');
initMemoryLimit('256M');
initErrors([
    'display_errors' => '1',
    'error_log'      => 'var/logs/php_errors.log',
], __DIR__);

// Load config and build the DI container
$config       = initConfig(__DIR__ . '/config', 'app.toml');
$definitions  = initDefinitions(__DIR__ . '/definitions');
$container    = initContainer($definitions, ['config' => $config]);

// Logger
$logger = new Logger(__DIR__ . '/var/logs', Logger::DEBUG);
$logger->info('Application started');
```

🧰 Usage
-------

[](#-usage)

### Init helpers

[](#init-helpers)

```
use function oihana\init\{ initDefaultTimezone, initMemoryLimit, initErrors, setIniIfExists };

initDefaultTimezone('UTC');
initMemoryLimit('512M');
initErrors([
    'display_errors'         => '1',
    'display_startup_errors' => '1',
    'error_log'              => 'var/logs/php_errors.log',
], __DIR__);

// Safe ini_set wrapper (no-op on empty values)
setIniIfExists('upload_max_filesize', '64M');
```

### Configuration and DI container

[](#configuration-and-di-container)

```
use function oihana\init\{ initConfig, initDefinitions, initContainer };

$config      = initConfig(__DIR__ . '/config', 'app.toml');
$definitions = initDefinitions(__DIR__ . '/definitions');
$container   = initContainer($definitions, ['config' => $config]);
```

### Logging (PSR-3)

[](#logging-psr-3)

```
use oihana\logging\Logger;

$logger = new Logger(__DIR__ . '/var/logs', Logger::INFO);
$logger->info('App started');
$logger->error('An error occurred: {error}', ['error' => 'boom']);

// Optional helpers
$logger->clear();             // remove all log files in log directory
$files = $logger->getLogFiles();
```

### HTTP helpers

[](#http-helpers)

```
use oihana\http\{ HttpMethod, HttpHeaders, HttpParamStrategy };

$method  = HttpMethod::POST;
$header  = HttpHeaders::CONTENT_TYPE;
$strategy = HttpParamStrategy::BOTH; // read from body and query
```

### TimeInterval (durations)

[](#timeinterval-durations)

```
use oihana\date\TimeInterval;

$d = new TimeInterval('1h 2m 5s');
echo $d->humanize();   // 1h 2m 5s
echo $d->formatted();  // 1:02:05
echo $d->toSeconds();  // 3725
```

✅ Running Unit Tests
--------------------

[](#-running-unit-tests)

To run all tests:

```
composer run-script test
```

To run a specific test file:

```
composer run test ./tests/oihana/date/TimeIntervalTest.php
```

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please:

- Open an issue for discussion before large changes
- Write tests for new features and bug fixes
- Run the full test suite locally before submitting a PR

🗒️ Changelog
------------

[](#️-changelog)

See `CHANGELOG.md` for notable changes.

🧾 License
---------

[](#-license)

This project is licensed under the [Mozilla Public License 2.0 (MPL-2.0)](https://www.mozilla.org/en-US/MPL/2.0/).

👤 About the author
------------------

[](#-about-the-author)

- Author: Marc ALCARAZ (aka eKameleon)
- Mail:
- Website:

🛠️ Generate the Documentation
-----------------------------

[](#️-generate-the-documentation)

We use [phpDocumentor](https://phpdoc.org/) to generate the documentation into the `./docs` folder.

```
composer doc
```

🔗 Related packages
------------------

[](#-related-packages)

- `oihana/php-core` – core helpers and utilities used by this library: `https://github.com/BcommeBois/oihana-php-core`
- `oihana/php-exceptions` – a curated set of reusable custom exception classes for PHP: `https://github.com/BcommeBois/oihana-php-exceptions`
- `oihana/php-reflect` – reflection and hydration utilities: `https://github.com/BcommeBois/oihana-php-reflect`
- `oihana/php-enums` – a collection of strongly-typed constant enumerations for PHP: `https://github.com/BcommeBois/oihana-php-enums`
- `oihana/php-files` – a versatile PHP library for seamless and portable file and path handling: `https://github.com/BcommeBois/oihana-php-files`
- `oihana/php-mysql` – MySQL utilities (DSN builder, PDO connection builder, admin model): `https://github.com/BcommeBois/oihana-php-mysql`

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance94

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity47

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

Total

4

Last Release

44d ago

### Community

Maintainers

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

---

Top Contributors

[![ekameleon](https://avatars.githubusercontent.com/u/749032?v=4)](https://github.com/ekameleon "ekameleon (460 commits)")

---

Tags

phplogginghelpersgraphicscontrollersdatemodelsreflections

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oihana-php-system/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)

PHPackages © 2026

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