Download the PHP package kaspi/di-container without Composer

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

DiContainer

Kaspi/di-container — это легковесный контейнер внедрения зависимостей для PHP >= 8.0.

Установка

Особенности

[!NOTE] Контейнер "пытается" самостоятельно определить запрашиваемую зависимость - является ли это классом или callable типом.

DiContainer выполнит следующие действия для App\Controllers\PostController:

[!TIP] Реализация кода в примере

Другой вариант для примера выше можно использовать для получения результата DiContainer::call():

[!TIP] Больше информации о DiContainer::call()

[!NOTE] Примеры использования пакета kaspi/di-container в репозитории

Конфигурирование DiContainer

Для конфигурирования контейнера используется класс Kaspi\DiContainer\DiContainerConfig::class который имплементируют интерфейс Kaspi\DiContainer\Interfaces\DiContainerConfigInterface

Или использовать фабрику с настроенными по умолчанию параметрами:

[!TIP] При попытке разрешить зависимость через метод get или аргумент конструктора, или метода:

  • $container->get(Psr\Container\ContainerInterface::class);
  • $container->get(Kaspi\DiContainer\DiContainer::class);
  • $container->get(Kaspi\DiContainer\Interfaces\DiContainerInterface::class);

будет получен текущий class Kaspi\DiContainer\DiContainer::class

📁 DefinitionsLoader

Загрузка конфигурации для контейнера зависимостей из нескольких файлов. Подробное описание использования DefinitionsLoader.

🧰 Подробное описание конфигурирования и использования

Тесты

Прогнать тесты без подсчёта покрытия кода

Запуск тестов с проверкой покрытия кода тестами

Статический анализ кода

Для статического анализа используем пакет PHPStan.

Code style

Для приведения кода к стандартам используем php-cs-fixer который объявлен в dev зависимости composer-а

Использование Docker образа с PHP 8.0, 8.1, 8.2, 8.3, 8.4

Указать образ с версией PHP можно в файле .env в ключе PHP_IMAGE. По умолчанию контейнер собирается с образом php:8.0-cli-alpine.

Собрать контейнер

Установить зависимости php composer-а:

🔔 Если установлен make в системе:

Тесты

Запуск тестов без отчёта о покрытии кода:

🔔 Если установлен make в системе:

Прогнать тесты с отчётом о покрытии кода:

🔔 Если установлен make в системе:

⛑ pезультаты будут в папке .coverage-html

Статический анализ кода PHPStan

если установлен make в системе:

Запуск комплексной проверки

Если установлен make – запуск проверки code-style, stat analyzer, tests:

Другое

Можно работать в shell оболочке в docker контейнере:


All versions of di-container with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4
psr/container Version ^2.0
ext-tokenizer Version *
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 kaspi/di-container contains the following files

Loading the files please wait ....