Download the PHP package phpnomad/php-di-integration without Composer

On this page you can find all versions of the php package phpnomad/php-di-integration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-di-integration

PHP-DI Integration for PHPNomad

PHP-DI-backed implementations of PHPNomad's InstanceProvider/HasBindings, ConfigStrategy, and Registry interfaces. An opt-in upgrade for consumers that want compilable, fast resolution while preserving PHPNomad's runtime extensibility.

Why

PHPNomad ships with an intentionally minimal default container. For distributed plugins (WordPress installs, etc.) where boot tax compounds across requests, this integration swaps in PHP-DI with build-time compilation — emitting a plain PHP class that opcache loads for free, eliminating per-request reflection cost.

The trade is a vendor dependency on php-di/php-di and a build-step that emits the compiled container. The runtime API matches PHPNomad's existing contract, so consumer code that already uses InstanceProvider, HasBindings, ConfigStrategy, or the Registry traits doesn't change.

Installation

Usage

As a suite (most common)

Add the suite Initializer to your bootstrapper:

CompiledContainerLoader::load($tier) returns a PhpDiContainer wrapping either a build-time-compiled \DI\Container subclass (fast path) or a runtime-built \DI\ContainerBuilder (fallback when no compiled artifact is present). The runtime path is identical to non-compiled PHP-DI behavior.

Piecemeal composition

Power users that only want one of the three concerns can compose sub-initializers directly. Container must come first since Config and Registry depend on InstanceProvider:

Build-time compilation

Wire Compiler::compileForTier() into your build step. Run it after composer install (and after any vendor-prefixing step like Strauss) so the compiled output references runtime class names correctly:

This emits a class at <outDir>/Lite.php that the runtime loader will prefer over the runtime-built container. Per-tier compilation is supported — pass different tier identifiers and initializer sets for builds that ship different binding configurations (e.g., free vs paid plugin tiers).

Boot order

Container must boot before Config and Registry, because the latter two resolve through InstanceProvider. The suite Initializer encodes this; piecemeal users must honor it manually.

Runtime overrides

The compiled container is not immutable. PHP-DI's set() against a built container takes precedence over compiled bindings, so tier switches, test bindings, and third-party extensions keep working at runtime. Compiled containers reject Definition objects via set() at runtime — the adapter's bind() and bindFactory() handle this transparently (eager-resolving raw values when the underlying container is compiled).

Multi-abstract bind semantics

This integration mirrors PHPNomad's simple Container::bind() semantics exactly: when you bind one concrete to multiple abstracts in a single call, all abstracts share the resulting instance. Each abstract aliases to the concrete independently — a later bind() that re-points one abstract leaves the others pointing at the original concrete. Self-binding (bind(Foo::class, Foo::class)) is special-cased to autowire directly rather than alias to itself.

Requirements

License

MIT


All versions of php-di-integration with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
phpnomad/di Version ^2.0
phpnomad/registry Version ^1.0
phpnomad/config Version ^1.0
phpnomad/loader Version ^1.0 || ^2.0
phpnomad/core Version ^2.0 || ^3.0
php-di/php-di Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phpnomad/php-di-integration contains the following files

Loading the files please wait ...