Download the PHP package quillstack/di without Composer

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

Quillstack DI Container

Tests Latest Version Downloads PHP Version StyleCI CodeFactor Quality Gate Coverage Maintainability Reliability Security License

A PSR-11 container which reads what a class needs from the class, and is built to do it quickly.

Why this exists

A container has two jobs and they pull against each other: work out what a class needs, and hand it over fast. Most containers answer that by making you choose — write the wiring out by hand and it is fast, let it work things out and it is slow. The ones that give you both compile a container to a PHP file, which is another build step, another cache to invalidate, and another thing that is stale in development.

This one reads a constructor and remembers what it read. Nothing is compiled and nothing is written to disk, and building a four-deep object graph from cold takes under a millisecond — see the benchmark.

It is also the container this framework runs on, which is the reason it exists at all: every other package here can be built by hand, without any container, and none of them needs this one. A container that packages depend on is a framework wearing a container's clothes.

Requirements

Installation

Usage

Nothing is registered. A class is asked for, and what its constructor declares is worked out:

Public typed properties are filled too, which is how a class asks for something it does not want in its constructor.

Interfaces

Say once which class answers to an interface:

Parameters

Where a class needs a value rather than an object, name it:

An object you already have

Where something is built once at boot and used everywhere, hand the object over:

Your own factory

Where a family of objects is built the same way — requests, reports, messages — write the factory and let the container use it:

create() is given the id that was asked for, which is what lets one factory serve a whole family.

Asking whether it can

Benchmark

Measured with quillstack/benchmark on one object graph four deep — a controller needing a service and a repository, the service needing the repository and a clock, the repository needing a connection. All four containers build the same graph. Runs are interleaved, each figure is the median of five, and PHP is 8.5.7.

Version
quillstack/di 0.6.0
php-di/php-di 7.1.1
league/container 4.2.5
symfony/dependency-injection v7.4.17

A container built and the graph resolved, in a fresh process — which is what a PHP request does:

Time Relative
quillstack/di 0.89 ms
symfony/dependency-injection, compiled and dumped 1.38 ms 1.6×
league/container 2.07 ms 2.3×
php-di/php-di 2.39 ms 2.7×
symfony/dependency-injection, compiling each time 15.65 ms 17.6×

The last row is the same container without its dump: Symfony compiles to a PHP file which is normally written once at deploy, so the row above it is the fair one. It is in the table because a container which has to be compiled is a build step this one does not have — in development, that 15 ms is what a changed class costs.

Asking again for something already built, a thousand times over:

Per call
symfony/dependency-injection, dumped 32 ns
php-di/php-di 40 ns
quillstack/di 53 ns
league/container 669 ns

This one is not the fastest here, and the gap is not worth having. All four are looking a key up in an array; 21 nanoseconds is nothing an application will feel, and the number that decides a request is the one above.

Tests

The rest of Quillstack

This is one component of Quillstack, a PHP framework which is as simple to use as it is strict about what it does.

License

MIT — see LICENSE.


All versions of di with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
psr/container Version ^1.1 || ^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 quillstack/di contains the following files

Loading the files please wait ...