Download the PHP package sirix/container-resolver without Composer

On this page you can find all versions of the php package sirix/container-resolver. 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 container-resolver

Container Resolver

Strict PSR-11 container service resolver and typed configuration reader for reusable PHP packages.

Stability

This package is currently pre-stable.

Until the first stable release, public contracts and behavior may change between releases based on real usage in Sirix packages. Semantic Versioning guarantees are not applied during this early iteration phase.

Use exact version constraints or review changelogs carefully when upgrading pre-stable versions.

Installation

Why

Package factories often need to read services and configuration from framework containers. Manual checks tend to repeat the same code, silently coerce invalid values, or fail with messages that do not explain which factory needs which value.

ContainerResolver and ConfigReader keep factory code small while preserving explicit failures:

The package is framework-agnostic and only requires PHP and psr/container at runtime.

Container services

Use ContainerResolver when a service id is the expected class or interface:

Use getAs() when the service id is a custom string but the expected type is known:

Use getExisting() when you want the raw service value and will validate it yourself:

Use optional() for optional services:

Use optionalArray() for array services such as config:

If the service is missing, optionalArray() returns []. If the service exists but is not an array, it throws InvalidContainerServiceException.

Typed configuration

ConfigReader reads nested arrays with dot paths:

Available methods:

Strictness rules

Missing optional values return the supplied default:

Existing invalid values always throw InvalidConfigValueException:

Valid scalar values must already have the expected type:

String readers trim leading and trailing whitespace from configured string values:

This applies to string values, non-empty strings, string lists, string enums, and PHP enum case names/string-backed values. Trimming is normalization of strings only; scalar coercion is still not performed.

optionalNonEmptyString() is useful for optional values where an empty string should be treated as not configured:

Behavior:

list() requires a sequential list array:

entities may be absent; in that case the default [] is returned. If entities exists, it must be a list of non-empty strings.

enum() returns real PHP enum instances:

Accepted configured values:

Numeric strings are not coerced for int-backed enums:

For string-backed enums, the string backed value is accepted:

map() requires all keys to be strings:

Lists are rejected by map() because they do not describe named configuration entries. String-keyed maps are rejected by list() because they are not sequential lists.

Long-running process safety

The package is safe to use in long-running processes such as RoadRunner, Swoole, ReactPHP, queue workers, and persistent Mezzio/Laminas applications.

It does not use:

Resolver and reader instances are cheap to create per factory invocation:

Exceptions do not retain service instances or full config arrays.

Exceptions

All package exceptions implement:

Container-related exceptions also implement:

Config-related exceptions also implement:

Concrete exceptions:

MissingContainerServiceException implements Psr\Container\NotFoundExceptionInterface. InvalidContainerServiceException implements Psr\Container\ContainerExceptionInterface.

ContainerResolver wraps missing-service and invalid-type failures into package exceptions. Other container resolution failures from the underlying PSR-11 container are propagated unchanged.

That means:

Public methods document their expected failure modes with @throws annotations.

Consumers can catch and wrap package exceptions:

Examples

Factory with configured service ids:

Design notes

This package intentionally does not provide:


All versions of container-resolver with dependencies

PHP Build Version
Package Version
Requires php Version ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0
psr/container Version ^1.0 || ^2.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 sirix/container-resolver contains the following files

Loading the files please wait ...