PHPackages                             nikolaposa/phoundation - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. nikolaposa/phoundation

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

nikolaposa/phoundation
======================

Facilitates the routine step of bootstrapping PHP applications.

3.1.0(3y ago)179.0kMITPHPPHP ^7.4 || ^8.0CI failing

Since Feb 26Pushed 3y ago2 watchersCompare

[ Source](https://github.com/nikolaposa/phoundation)[ Packagist](https://packagist.org/packages/nikolaposa/phoundation)[ RSS](/packages/nikolaposa-phoundation/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (7)Versions (9)Used By (0)

Phoundation
===========

[](#phoundation)

[![Build Status](https://github.com/nikolaposa/phoundation/workflows/Build/badge.svg?branch=master)](https://github.com/nikolaposa/phoundation/actions)[![Code Quality](https://camo.githubusercontent.com/752c4408e81a03223aad00624a7acb4ea4ca92a129b8647b4f50f81a1876edf1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e696b6f6c61706f73612f70686f756e646174696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/nikolaposa/phoundation)[![Code Coverage](https://camo.githubusercontent.com/eef3b9e9e800d65f2dd176c781481509bd1ac595435cd9084aae59f007081e86/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e696b6f6c61706f73612f70686f756e646174696f6e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/nikolaposa/phoundation/code-structure)[![Latest Version](https://camo.githubusercontent.com/6a7397f21397f4ee88b0cca4a490558a82226af15da307dcec2ce3c6b064dac5/68747470733a2f2f706f7365722e707567782e6f72672f6e696b6f6c61706f73612f70686f756e646174696f6e2f762f737461626c65)](https://packagist.org/packages/nikolaposa/phoundation)[![PDS Skeleton](https://camo.githubusercontent.com/a8ce1f2a7b71f101b18fc0393ba5bf89b7a5b1f9d08a31b658ca0eab0064c0f6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7064732d736b656c65746f6e2d626c75652e737667)](https://github.com/php-pds/skeleton)

Phoundation (pronounced the same way as "foundation") facilitates the routine step of bootstrapping PHP applications.

Installation
------------

[](#installation)

The preferred method of installation is via [Composer](http://getcomposer.org/). Run the following command to install the latest version of a package and add it to your project's `composer.json`:

```
composer require nikolaposa/phoundation
```

Purpose
-------

[](#purpose)

Bootstrapping of today's PHP applications typically comes down to:

1. Configuration loading
2. Dependency Injection Container initialization

Phoundation aims to reduce the amount of repetitive code needed for the application startup logic by abstracting bootstrapping process.

Usage
-----

[](#usage)

Given the configuration files:

config/global.php

```
return [
    'db' => [
        'driver' => 'pdo_mysql',
        'host' => 'localhost',
        'user' => 'root',
        'password' => 'secret',
        'dbname' => 'test',
    ],
    'dependencies' => [
        'factories' => [
            \PDO::class => function () {
                return new \PDO('sqlite::memory:');
            },
            'My\\Web\\Application' => My\Web\ApplicationFactory::class,
        ]
    ],
];
```

config/local.php

```
return [
    'db' => [
        'user' => 'admin',
        'password' => '1234',
    ],
];
```

Create bootstrap script which typically lives in `src/bootstrap.php`:

```
use Phoundation\Bootstrap;
use Phoundation\Config\FileConfigLoader;
use Phoundation\DependencyInjection\LaminasServiceManagerFactory;

$bootstrap = new Bootstrap(
    new FileConfigLoader(glob(sprintf('config/{{,*.}global,{,*.}%s}.php', getenv('APP_ENV') ?: 'local'), GLOB_BRACE)),
    new LaminasServiceManagerFactory()
);

return $bootstrap();
```

Load bootstrap in your web application root (for example `public/index.php`):

```
/* @var \Psr\Container\ContainerInterface $diContainer */
$diContainer = require  __DIR__ . '/../src/bootstrap.php';

$diContainer->get('My\\Web\\Application')->run();
```

Credits
-------

[](#credits)

- [Nikola Poša](https://github.com/nikolaposa)
- [All Contributors](../../contributors)

License
-------

[](#license)

Released under MIT License - see the [License File](LICENSE) for details.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 93.6% 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 ~362 days

Recently: every ~516 days

Total

7

Last Release

1236d ago

Major Versions

0.1.0 → 1.0.02017-03-04

1.1.x-dev → 2.0.02017-06-25

2.0.0 → 3.0.02020-03-28

PHP version history (3 changes)0.1.0PHP ^7.0

3.0.0PHP ^7.2

3.1.0PHP ^7.4 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![nikolaposa](https://avatars.githubusercontent.com/u/6012807?v=4)](https://github.com/nikolaposa "nikolaposa (88 commits)")[![dusanvejin](https://avatars.githubusercontent.com/u/119709?v=4)](https://github.com/dusanvejin "dusanvejin (3 commits)")[![dutekvejin](https://avatars.githubusercontent.com/u/119709?v=4)](https://github.com/dutekvejin "dutekvejin (3 commits)")

---

Tags

bootstrapconfigdependency-injectiondi-containerpsr-11PSR-11bootstrap

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nikolaposa-phoundation/health.svg)

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

###  Alternatives

[php-di/php-di

The dependency injection container for humans

2.8k53.2M1.2k](/packages/php-di-php-di)[laminas/laminas-servicemanager

Factory-Driven Dependency Injection Container

15857.5M782](/packages/laminas-laminas-servicemanager)[laminas/laminas-di

Automated dependency injection for PSR-11 containers

3618.9M43](/packages/laminas-laminas-di)[bnf/phpstan-psr-container

PHPStan dynamic return type extension for PSR-11 ContainerInterface

133.8M109](/packages/bnf-phpstan-psr-container)

PHPackages © 2026

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