PHPackages                             maatify/bootstrap - 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. [Framework](/categories/framework)
4. /
5. maatify/bootstrap

ActiveLibrary[Framework](/categories/framework)

maatify/bootstrap
=================

Unified environment initialization and diagnostics foundation for all Maatify PHP projects. Provides predictable .env loading, timezone configuration, and Safe Mode protection across local, CI, and production environments — forming the core bootstrap layer for the Maatify ecosystem.

v1.0.4(6mo ago)175112MITPHPPHP &gt;=8.3CI passing

Since Nov 9Pushed 6mo agoCompare

[ Source](https://github.com/Maatify/bootstrap)[ Packagist](https://packagist.org/packages/maatify/bootstrap)[ Docs](https://github.com/Maatify/bootstrap)[ RSS](/packages/maatify-bootstrap/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (6)Used By (2)

[![Maatify.dev](https://camo.githubusercontent.com/bb8bf9ee079d7f823c9d5e94061d1d4c11dc0898e2b1b5cc9a8a7b04d8bfdd7d/68747470733a2f2f7777772e6d6161746966792e6465762f6173736574732f696d672f696d672f6d6161746966795f6c6f676f5f77686974652e737667)](https://camo.githubusercontent.com/bb8bf9ee079d7f823c9d5e94061d1d4c11dc0898e2b1b5cc9a8a7b04d8bfdd7d/68747470733a2f2f7777772e6d6161746966792e6465762f6173736574732f696d672f696d672f6d6161746966795f6c6f676f5f77686974652e737667)

---

⚙️ Maatify Bootstrap
====================

[](#️-maatify-bootstrap)

[![Version](https://camo.githubusercontent.com/1d19ce4b44a742932b837fe6505ceae7ac72264208839171d8abee51c0f9a3ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6161746966792f626f6f7473747261703f6c6162656c3d56657273696f6e26636f6c6f723d344331)](https://packagist.org/packages/maatify/bootstrap)[![PHP](https://camo.githubusercontent.com/72262d05f9a3bdb23893bfa9e7d45a389103517d556a7a5e5798b895ab823a3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d6161746966792f626f6f7473747261703f6c6162656c3d50485026636f6c6f723d373737424233)](https://packagist.org/packages/maatify/bootstrap)[![Build](https://github.com/Maatify/bootstrap/actions/workflows/test.yml/badge.svg?label=Build&color=brightgreen)](https://github.com/Maatify/bootstrap/actions/workflows/test.yml)

[![Monthly Downloads](https://camo.githubusercontent.com/ab508f7ac220ce64882cd022c52f1363de0c2cb944522913d9bf8565e9004c5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d6161746966792f626f6f7473747261703f6c6162656c3d4d6f6e74686c79253230446f776e6c6f61647326636f6c6f723d303041384538)](https://packagist.org/packages/maatify/bootstrap)[![Total Downloads](https://camo.githubusercontent.com/6e5ac1eab7fe055bff433300895a37a464077a3f578c44fc42e4466bcd8eacd0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6161746966792f626f6f7473747261703f6c6162656c3d546f74616c253230446f776e6c6f61647326636f6c6f723d324141394530)](https://packagist.org/packages/maatify/bootstrap)

[![Stars](https://camo.githubusercontent.com/495470990244af91ae9e5e1505f1ffdf2f4a6b6b27baecf799ddaa2c4925c282/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f4d6161746966792f626f6f7473747261703f6c6162656c3d537461727326636f6c6f723d4646443433422663616368655365636f6e64733d33363030)](https://github.com/Maatify/bootstrap/stargazers)[![License](https://camo.githubusercontent.com/6128fdba4b36182a4df4b92fa614f9d0faad4b0408cb7eddf143b0e2ce8d5413/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4d6161746966792f626f6f7473747261703f6c6162656c3d4c6963656e736526636f6c6f723d626c756576696f6c6574)](LICENSE)![Status](https://camo.githubusercontent.com/2128a821a9f55f8f5e5806efa8de7dfe863140215ec85b68a1d4301610cfdd32/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5374617475732d537461626c652d737563636573733f7374796c653d666c61742d737175617265)[![Code Quality](https://camo.githubusercontent.com/4ac7b61954a68913b8a906d0b09783b1bae211386a884c02c874fbd2e085667d/68747470733a2f2f696d672e736869656c64732e696f2f636f6465666163746f722f67726164652f6769746875622f4d6161746966792f626f6f7473747261702f6d61696e3f636f6c6f723d627269676874677265656e)](https://www.codefactor.io/repository/github/Maatify/bootstrap)

[![Changelog](https://camo.githubusercontent.com/32f7664d004132f7e0fb111b5e01bd7270705d1e7247db502287d51910c04cb9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4368616e67656c6f672d566965772d626c7565)](CHANGELOG.md)[![Security](https://camo.githubusercontent.com/a150750c8b2c6ca6209aa80bdf220d2f0950b984df64c1b859a46ee9152570f3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53656375726974792d506f6c6963792d696d706f7274616e74)](SECURITY.md)

---

### Unified Environment Initialization &amp; Diagnostics Layer

[](#unified-environment-initialization--diagnostics-layer)

**Project:** `maatify:bootstrap`
**Version:** 1.0.3
**License:** MIT
**Author:** [Mohamed Abdulalim (megyptm)](mailto:mohamed@maatify.dev)
**© 2025 Maatify.dev**

> 🔗 [بالعربي 🇸🇦 ](./README-AR.md)

---

🧭 Overview
----------

[](#-overview)

`maatify/bootstrap` is the **core foundation** for the entire Maatify ecosystem —
providing standardized environment initialization, diagnostics, timezone setup, and safe startup checks
for every Maatify PHP library and application.

It ensures consistent, predictable, and secure runtime behavior across:

- Local development
- CI/CD pipelines
- Staging and production environments

---

⚙️ Installation
---------------

[](#️-installation)

```
composer require maatify/bootstrap
```

---

📦 Dependencies
--------------

[](#-dependencies)

This library relies on:

DependencyPurposeLink**vlucas/phpdotenv**Secure `.env` file loader and environment manager[github.com/vlucas/phpdotenv](https://github.com/vlucas/phpdotenv)**psr/log**PSR-3 compatible logging interface[www.php-fig.org/psr/psr-3](https://www.php-fig.org/psr/psr-3/)**phpunit/phpunit**Unit testing framework (development only)[phpunit.de](https://phpunit.de)> `maatify/bootstrap` builds upon these open-source libraries to provide a unified and secure initialization layer across the entire Maatify ecosystem.

---

### 🧩 Internal Dependency Hierarchy

[](#-internal-dependency-hierarchy)

`maatify/bootstrap` follows a **hierarchical dependency chain** within the Maatify ecosystem, ensuring that all foundational layers are automatically included — without redundancy or version conflicts.

LayerLibraryPurposeAuto-Loaded🧱 1**maatify/psr-logger**Provides PSR-3 compliant logging for consistent system-wide logging.✅ Included🧩 2**maatify/common**Core utilities and helpers (paths, environment helpers, string sanitization, etc.)✅ Included through `psr-logger`⚙️ 3**maatify/bootstrap**Initializes and validates environment setup and runtime behavior.—🧠 4**Other Maatify Libraries**e.g. `maatify/rate-limiter`, `maatify/redis-cache`, `maatify/security-guard`Depend only on `bootstrap`> 🧩 **Note:**Installing `maatify/bootstrap` **automatically includes**both `maatify/common` and `maatify/psr-logger`. You do **not** need to manually require them — they are resolved internally via Composer dependencies.

---

#### 📦 Dependency Chain Diagram

[](#-dependency-chain-diagram)

 ```
graph TD
    A[maatify/psr-logger]:::core --> B[maatify/common]:::core
    B --> C[maatify/bootstrap]:::main
    C --> D["Other Maatify Libraries (rate-limiter, redis-cache, security-guard...)"]:::ext

    classDef core fill:#0066cc,color:#ffffff,stroke:#003366,stroke-width:2px;
    classDef main fill:#009933,color:#ffffff,stroke:#004d1a,stroke-width:2px;
    classDef ext fill:#ffcc00,color:#000000,stroke:#996600,stroke-width:2px;

```

      Loading > This diagram shows how each Maatify package inherits initialization and logging automatically through the unified bootstrap layer — ensuring consistent configuration and predictable startup behavior.

---

### 🧩 Version Compatibility Matrix

[](#-version-compatibility-matrix)

LibraryPHP 8.2PHP 8.3PHP 8.4CI Support**maatify/psr-logger**⚠️ Partial✅ Full✅ Full✅**maatify/common**⚠️ Partial✅ Full✅ Full✅**maatify/bootstrap**⚠️ Partial✅ Full✅ Full✅**maatify/rate-limiter**❌✅ Full✅ Full✅**maatify/redis-cache**❌✅ Full✅ Full✅> ⚙️ **Notes:**
>
> - Official testing and CI pipelines target **PHP 8.3** and **8.4**.
> - Backward compatibility with PHP 8.2 is limited and not guaranteed.
> - All Maatify core packages maintain synchronized versioning and consistent dependency alignment.

---

🧩 Features
----------

[](#-features)

- 🔐 Unified `.env` file loader with priority-based detection
- 🌍 Timezone configuration (`APP_TIMEZONE` → default `Africa/Cairo`)
- 🧠 Smart environment caching via `EnvHelper`
- 🧱 Cross-library bootstrap via `Bootstrap::init()`
- 🚦 Safe Mode activation for production protection
- 🧪 Full PHPUnit test coverage with CI integration
- 🐳 Docker &amp; GitHub Actions ready

---

🧠 Environment Loading Priority
------------------------------

[](#-environment-loading-priority)

`maatify/bootstrap` loads only one `.env` file per execution — based on strict precedence:

PriorityFilePurpose1️⃣`.env.local`Developer/private overrides2️⃣`.env.testing`CI or PHPUnit configuration3️⃣`.env`Main production configuration4️⃣`.env.example`Always-available fallback template> Once a file is found, loading **stops immediately** — ensuring lower-priority files cannot override higher ones. Uses `Dotenv::createImmutable()` (from **vlucas/phpdotenv**) for safety, preventing accidental overwrites.

---

🧠 Usage Example
---------------

[](#-usage-example)

```
use Maatify\Bootstrap\Core\Bootstrap;

Bootstrap::init();

// Access loaded variables
$env = $_ENV['APP_ENV'] ?? 'production';
echo "Running in environment: $env";
```

or for diagnostic mode:

```
use Maatify\Bootstrap\Core\BootstrapDiagnostics;
use Maatify\PsrLogger\LoggerFactory;

$logger = LoggerFactory::create('bootstrap');
$diag = new BootstrapDiagnostics($logger);

print_r($diag->run());
```

---

🧰 Docker Integration
--------------------

[](#-docker-integration)

For consistent environment parity between local and CI:

```
docker compose up --build
docker compose exec bootstrap composer run-script test
```

---

🧪 Testing
---------

[](#-testing)

Run tests locally:

```
composer run-script test
```

CI is automatically triggered via GitHub Actions:

```
.github/workflows/tests.yml

```

---

📄 Documentation
---------------

[](#-documentation)

Full technical documentation covering all phases (1 → 7): 👉 [**docs/README.full.md**](./docs/README.full.md)

---

**Maatify Bootstrap** — *“Initialize once, stabilize everywhere.”*

---

📚 Built Upon
------------

[](#-built-upon)

`maatify/bootstrap` is proudly built upon and extends several foundational open-source projects:

LibraryDescriptionUsage in Project**[vlucas/phpdotenv](https://github.com/vlucas/phpdotenv)**Industry-standard `.env` loader for PHPProvides immutable and secure environment loading across all Maatify projects.**[psr/log](https://www.php-fig.org/psr/psr-3/)**PHP-FIG PSR-3 logging interfaceEnables standardized, interchangeable logging (used by `BootstrapDiagnostics` and PSR loggers).**[phpunit/phpunit](https://phpunit.de)**PHP unit testing frameworkPowers the complete automated test suite with CI/CD integration.> Special thanks to the maintainers of these open-source libraries for providing the stable foundations that make this project possible. ❤️

---

🪪 License
---------

[](#-license)

**[MIT license](LICENSE)** © [Maatify.dev](https://www.maatify.dev)
You’re free to use, modify, and distribute this library with attribution.

---

🧱 Authors &amp; Credits
-----------------------

[](#-authors--credits)

**Developed by:** [**Maatify.dev**](https://www.maatify.dev)
**Maintainer:** Mohamed Abdulalim
**Project:** `maatify:bootstrap`

---

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance68

Regular maintenance activity

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

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

Total

5

Last Release

186d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a885a0810f2762586520ab284c9019aaf0b650b53cdf2a6c13ea10931bb7795?d=identicon)[Maatify](/maintainers/Maatify)

---

Top Contributors

[![megyptm](https://avatars.githubusercontent.com/u/33574895?v=4)](https://github.com/megyptm "megyptm (45 commits)")

---

Tags

psrphpunitframeworkconfigurationenvironmentdotenvdockerbootstrapfoundationciecosysteminitializationdiagnosticstimezoneenv-loadermaatifymaatify.devstartupsafe mode

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/maatify-bootstrap/health.svg)

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

PHPackages © 2026

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