The goal set by ContainerInterface is to standardize how frameworks and libraries make use of a container to obtain objects and parameters. An entry identifier is any PHP-legal string of at least one character that uniquely identifies an item within a container. An entry identifier is an opaque string, so callers should not assume that the structure of the string carries any semantic meaning. The Psr\Container\ContainerInterface exposes two methods, get and has. get takes one mandatory parameter: an entry identifier, which must be a string. get can return anything (a mixed value), or throw a NotFoundExceptionInterface if the identifier is not known to the container. Two successive calls to get with the same identifier should return the same value. has takes one unique parameter: an entry identifier, which must be a string. has must return true if an entry identifier is known to the container and false if it is not.

Features

  • The interfaces and classes described as well as relevant exceptions are provided as part of the psr/container package
  • Standardize how frameworks and libraries make use of a container to obtain objects and parameters
  • All containers offer a method to get an entry by its id
  • Compatible with existing containers that have additional optional parameters
  • PHP allows an implementation to offer more parameters as long as they are optional
  • This PSR provides 2 interfaces meant to be implemented by container exceptions

Project Samples

Project Activity

See All Activity >

Categories

Frameworks, Libraries

License

MIT License

Follow PSR-11 Container interface

PSR-11 Container interface Web Site

Other Useful Business Software
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of PSR-11 Container interface!

Additional Project Details

Programming Language

PHP

Related Categories

PHP Frameworks, PHP Libraries

Registered

2021-06-22