PHPackages                             oihana/php-init - 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. oihana/php-init

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

oihana/php-init
===============

The Oihana PHP Init library

1.0.0(1mo ago)13341MPL-2.0PHP &gt;=8.4

Since Jun 21Compare

[ Source](https://github.com/BcommeBois/oihana-php-init)[ Packagist](https://packagist.org/packages/oihana/php-init)[ Docs](https://github.com/BcommeBois/oihana-php-init)[ RSS](/packages/oihana-php-init/feed)WikiDiscussions Synced 2w ago

READMEChangelogDependencies (8)Versions (2)Used By (1)

Oihana PHP - Init
=================

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

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

Application bootstrap helpers for PHP 8.4+ — config loading, DI container building and PHP runtime setup.

[![Latest Version](https://camo.githubusercontent.com/b8e7862fa39a9f71f90140c4749ff18d3eb2f7cf3ba5f9a7caa494c392904ec4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6968616e612f7068702d696e69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oihana/php-init)
[![Total Downloads](https://camo.githubusercontent.com/f7fb26a89652a5804ed52278d1fe2cf309fee98f3aa3d683d85ade6a5a514769/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6968616e612f7068702d696e69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oihana/php-init)
[![License](https://camo.githubusercontent.com/6b6f273ee1651f14aa5b6a07806dad643b4e0cba7c19f81b90c14701cc2c603d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f6968616e612f7068702d696e69742e7376673f7374796c653d666c61742d737175617265)](LICENSE)

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

[](#-documentation)

User guides (FR + EN), with narrative explanations and examples:

🇬🇧 **[English documentation](wiki/en/README.md)**🇫🇷 **[Documentation française](wiki/fr/README.md)**Getting started, configuration, container &amp; definitions, runtime, testing.Démarrage, configuration, conteneur &amp; définitions, runtime, tests.Auto-generated API reference (phpDocumentor):
👉

🧠 What is it?
-------------

[](#-what-is-it)

`oihana/php-init` is a small set of free functions that bootstrap a PHP application: load and merge a TOML/array configuration, build a [PHP-DI](https://php-di.org/) container from definition files, and configure the PHP runtime (timezone, error reporting, memory limit, `ini` directives).

```
use DI\Container;

use function oihana\init\initConfig;
use function oihana\init\initContainer;
use function oihana\init\initDefinitions;

// 1. Load configuration (config.toml under the given base path)
$config = initConfig( __DIR__ . '/config' );

// 2. Build a DI container from all PHP definition files in a directory
$definitions = initDefinitions( __DIR__ . '/definitions' );
$container    = initContainer( $definitions );
```

🚀 Features
----------

[](#-features)

- ⚙️ Config loading &amp; merging (TOML + PHP arrays) — `initConfig()`.
- 📦 PHP-DI container building from definitions — `initContainer()`, `initDefinitions()`.
- 🕐 PHP runtime setup — `initDefaultTimezone()`, `initErrors()`, `initMemoryLimit()`, `setIniIfExists()`.
- 🧩 Plain free functions, autoloaded — no framework lock-in.
- 🧪 Full unit-test coverage ensuring reliability and maintainability.

💡 Designed to be lightweight, testable, and compatible with any PHP 8.4+ project.

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

[](#-installation)

> **Requires [PHP 8.4+](https://php.net/releases/)**

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

```
composer require oihana/php-init
```

✅ Tests &amp; coverage
----------------------

[](#-tests--coverage)

Run the full unit-test suite (PHPUnit, strict mode):

```
composer test
```

Run a single test case:

```
./vendor/bin/phpunit --filter InitContainerTest
```

Measure coverage (requires Xdebug or PCOV):

```
composer coverage        # text + Clover + HTML under build/coverage/
composer coverage:md     # readable Markdown summary (build/coverage/COVERAGE.md)
```

The suite runs in **strict mode** and targets **100% line coverage**.

🧾 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.

### Usage

[](#usage)

Run the command :

```
composer doc
```

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

[](#-related-packages)

- [oihana/php-files](https://github.com/BcommeBois/oihana-php-files) – file, path and TOML config helpers used to load configuration.
- [oihana/php-enums](https://github.com/BcommeBois/oihana-php-enums) – strongly-typed constant enumerations (`IniOptions`, …).
- [oihana/php-reflect](https://github.com/BcommeBois/oihana-php-reflect) – reflection utilities and exception types.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance90

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

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

---

Tags

phpconfigdependency-injectionbootstraptomlphp-di

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[infinum/eightshift-libs

WordPress libs developed by Eightshift team to use in modern WordPress.

63127.2k3](/packages/infinum-eightshift-libs)[drupal-code-builder/drupal-code-builder

Code generator for Drupal

27257.3k1](/packages/drupal-code-builder-drupal-code-builder)[duxweb/dux-lite

The lightweight framework based on slim php

161.0k9](/packages/duxweb-dux-lite)

PHPackages © 2026

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