Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Jun 20, 2024 via composer

psr/container 1.1.2

Common Container Interface (PHP FIG PSR-11)
Package summary
Share
0
issues
1
license
1
MIT
Package created
8 Sep 2016
Version published
5 Nov 2021
Maintainers
3
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
psr/container@1.1.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of psr/container 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does psr/container do?

The psr/container is a PHP package that facilitates the definition of interfaces as per the PHP Standard Rrecommendation 11 (PSR-11). It's not a standalone Container implementation, but rather an abstraction that outlines the components of a Dependency Injection Container. The principal function of this package is to standardize how developers design containers to manage dependencies, ensuring a uniform coding experience.

How do you use psr/container?

Utilizing the psr/container in your PHP projects is straightforward. Firstly, ensure that you have Composer installed to manage dependencies. Afterward, you can add the package to your project by running the following command:

composer require psr/container

And then in your PHP file:

<?php

use Psr\Container\ContainerInterface;

class MyClass {

  private $container;

  public function __construct(ContainerInterface $container) {
    $this->container = $container;
  }
  
  public function doSomething() {
    $service = $this->container->get('my_service');
    $service->execute();
  }
}

In this example, MyClass depends on my_service. Instead of creating my_service directly in MyClass, we inject the container, and the container can provide my_service.

Remember that every service or component interacting with the container should comply with the interfaces defined in PSR-11.

Where are the psr/container docs?

The psr/container package doesn't have separate official documentation as its paradigm and usage is documented in PSR-11. You can find the relevant information and understand its usage on the official PSR-11 page available at https://www.php-fig.org/psr/psr-11/. All necessary details about how to implement a conforming Container are present in these PSR-11 guidelines.