Download the PHP package slava-basko/container without Composer

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

Dependency Injection Container

For those who understand what it is and strive for simplicity.

Zero dependencies and PHP 7.1+.

Features

Simple API

Consider Container as a regular array.

Easier than ever for simple script/app.

Tags

Things get a bit more complicated when you need tags. Use the Container::add() method to setup tags.

Use the Container::getByTag() method to retrieve services by tags. This separate method exists because regular get should return a specific service or throw a NotFoundException exception.

Clear and strict separation: Container::get() returns a service or throws NotFoundException, and the Container::getByTag() returns an array of services of throws NotFoundException.

Alias

This container has no separate feature like alias for two main reasons.

Use tagging functionality to achieve the same $service = $container->getByTag('tag')[0];. Don't worry about Warning: Undefined array key 0 because container does not return an empty array. It will return an array of services or throw NotFoundException like regular get.

Most likely, you want to use alias to avoid class name exposure. For example when you want to get service by requests param.

Shared Instances

Use Container::addShared() method to create a shareable service. Container will return the same instance each time.

Service Extenders

Use Container::extend() to modify services by a common parent.

Circular Dependency Detection

Container will let you know if you have a circular dependency.

Autowiring

Use AutowireContainer for automatic dependency resolving.

Rewrite Protection

Container will throw an exception if you accidentally rewrite the service definition.

But what if I need to overwrite definition!

Shift your mindset from "overwrite" to "setup based on X condition" and do it in the user-land code.

This approach, together with Rewrite Protection, will keep your code strict and more understandable. There will be no hidden overwrites.

Service Providers

Providers give you the benefit of organizing your definitions.

Then, add the provider to the container.

Symlinks

You can create symlinks that allow you to get different services on the run, without changing user-land code.

Note: Only one symlink to a specific service can exist at a time.

Graph

Using the DOT language, build a graph (as in nodes and edges, not as in bar charts). Note: Graph not working with AutowireContainer.

For example, you can visualize the output of Graphviz::build() with https://dreampuf.github.io/GraphvizOnline.

Graph element explanation:

PSR-11

Install psr/container package first.

Then wrap Container in PsrContainer and pass it to whoever expected Psr\Container\ContainerInterface.


All versions of container with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
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 slava-basko/container contains the following files

Loading the files please wait ...