Skip to content

Installation

Muhammet Şafak edited this page May 29, 2026 · 1 revision

Installation

Requirements

PHP ^8.1 (tested up to 8.4)
Extensions None
Runtime dependencies psr/container ^2.0

The only runtime dependency is the PSR-11 interface package, which Composer installs automatically. Development dependencies (PHPUnit, PHPStan, PHP-CS-Fixer) live under require-dev and are not installed when you depend on initphp/container from another project.

Install via Composer

composer require initphp/container

The classes are autoloaded under the InitPHP\Container namespace via PSR-4:

{
    "autoload": {
        "psr-4": {
            "InitPHP\\Container\\": "src/"
        }
    }
}

Because the package declares provide: { "psr/container-implementation": "2.0" }, any library that requires the virtual psr/container-implementation package is satisfied by installing initphp/container.

Verifying the install

<?php
require __DIR__ . '/vendor/autoload.php';

use InitPHP\Container\Container;

$container = new Container();

var_dump($container instanceof \Psr\Container\ContainerInterface); // bool(true)

If the autoloader cannot locate the class, double-check that you ran composer install (or composer dump-autoload) and that your script requires vendor/autoload.php before instantiating the container.

Supported PHP versions in CI

Every push and pull request runs the test matrix against:

  • PHP 8.1
  • PHP 8.2
  • PHP 8.3
  • PHP 8.4

…each with both the lowest and highest allowed dependency versions. A separate job runs PHPStan (max level) and PHP-CS-Fixer (PSR-12). If you discover a regression on a supported version, please file an issue and include the PHP version reported by php -v.

Next steps

Clone this wiki locally