Download the PHP package psr-discovery/container-implementations without Composer

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

Lightweight library that discovers available PSR-11 Container implementations by searching for a list of well-known classes that implement the relevant interface, and returns an instance of the first one that is found.

This package is part of the PSR Discovery utility suite, which also supports PSR-18 HTTP Clients, PSR-17 HTTP Factories, PSR-14 Event Dispatcher, PSR-6 Caches and PSR-3 Logs.

This is largely intended for inclusion in libraries like SDKs that wish to support PSR-11 Containers without requiring hard dependencies on specific implementations or demanding extra configuration by users.

Requirements

Successful discovery requires the presence of a compatible implementation in the host application. This library does not install any implementations for you.

Implementations

The following psr/container-implementation implementations are discovered and instantiated automatically:

The following mock implementations are also available:

If a particular implementation is missing that you'd like to see, please open a pull request adding support.

Installation

Usage

Handling Failures

If the library is unable to discover a suitable PSR-11 implementation, the Discover::container() discovery method will simply return null. This allows you to handle the failure gracefully, for example by falling back to a default implementation.

Example:

Singletons

By default, the Discover::container() method will always return a new instance of the discovered implementation. If you wish to use a singleton instance instead, simply pass true to the $singleton parameter of the discovery method.

Example:

Mocking Priority

This library will give priority to searching for a known, available mocking library before searching for a real implementation. This is to allow for easier testing of code that uses this library.

The expectation is that these mocking libraries will always be installed as development dependencies, and therefore if they are available, they are intended to be used.

Preferring an Implementation

If you wish to prefer a specific implementation over others, you can prefer() it by package name:

This will cause the container() method to return the preferred implementation if it is available, otherwise, it will fall back to the default behavior.

Note that assigning a preferred implementation will give it priority over the default preference of mocking libraries.

Using a Specific Implementation

If you wish to force a specific implementation and ignore the rest of the discovery candidates, you can use() its package name:

This will cause the container() method to return the preferred implementation if it is available, otherwise, it will return null.


This library is not produced or endorsed by, or otherwise affiliated with, the PHP-FIG.


All versions of container-implementations with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
psr/container Version ^1.0 | ^2.0
psr-discovery/discovery Version ^1.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 psr-discovery/container-implementations contains the following files

Loading the files please wait ....