Download the PHP package corviz/di-container without Composer

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

di-container

A simple yet powerful container with auto wiring

Installation

Usage

Here are some common scenarios you will meet when using container + dependency injection

For these examples, we will assume the following classes:

Retrieve a new instance from container

Note that no previous declaration was required!

Auto-wiring and parameter types

What if we need a new instance of B?

Because we declared a parameter with type "A" in the constructor, and it is a class, our container will try to create a new instance automatically. This is done though Reflection.

If we needed to receive a primitive type as parameter, we have to declare a default value otherwise the container will throw a ContainerException, since it can't guess how to fill it.

Manual setup

You may want to set some objects manually in some particular cases. To do so, simply use 'set' method.

Aliases

If we want to alias something, all we have to do is set it in our container as usual

Singletons

When we want to access the same object through the entire execution, all we have to do is use 'setSingleton'. It accepts the same definition variants as 'set'. In other words, you may use the class name, a constructor closure or an object instance.

Invoking methods

Let's assume the following class:


All versions of di-container with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
psr/container Version ^2.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 corviz/di-container contains the following files

Loading the files please wait ....