Download the PHP package gspataro/dependencyinjection without Composer

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

GSpataro/DependencyInjection

A dependency injection container component made to handle the booting process of your application easier.


Installation

Requires [PHP 8.0+](PHP: Releases)

To install this package you have to require it with Composer:


Quick start

The fastest way to use the container is to initialize it and provide the services that you need:


Container

The Container class is the heart of this component.

Service dependencies

When defining a service, the Container class and params array are passed to the factory to have access to the class dependencies.

Variables

Sometimes some configurations or other variables will be needed globally across services. In this case, you can define variables accessible by the container.

Direct instance

If you need to instanciate a new class but you don't need to register it as a service, you can directly instanciate it. This is not recomended, but you'll still need it in some cases:


Components

The components are another feature of the container. The issue is: if you define your services one by one, the risk of booting a service before its dependency is higher and you have to remember what you booted first.

To simplify this process, the components are "archives" of services that will be booted in the order you specify.

Defining a component

Boot components

To boot your components you need to register them into the container and then call the boot method.

Let's assume you have two components: ComponentA and ComponentB. If ComponentA depends on some services provided by ComponentB, you can change the order of them in the loadComponents method:


All versions of dependencyinjection with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 gspataro/dependencyinjection contains the following files

Loading the files please wait ....