<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
psr-discovery / container-implementations example snippets
use PsrDiscovery\Discover;
// Return an instance of the first discovered PSR-11 Container implementation.
$container = Discover::container();
$container->get(...)
use PsrDiscovery\Discover;
$container = Discover::container();
if ($container === null) {
// No suitable Container implementation was discovered.
// Fall back to a default implementation.
$container = new DefaultContainer();
}
use PsrDiscovery\Discover;
use PsrDiscovery\Implementations\Psr11\Containers;
// Prefer the a specific implementation of PSR-11 over others.
Containers::prefer('league/container');
// Return an instance of League\Container\Container,
// or the next available from the list of candidates,
// Returns null if none are discovered.
$container = Discover::container();
use PsrDiscovery\Discover;
use PsrDiscovery\Implementations\Psr11\Containers;
// Only discover a specific implementation of PSR-11.
Containers::use('league/container');
// Return an instance of League\Container\Container,
// or null if it is not available.
$container = Discover::container();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.