Download the PHP package kode/di without Composer

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

kode/di

PHP Version PSR-11

高性能 PHP 8.1+ 依赖注入容器,支持属性注入、生命周期管理、协程上下文隔离,兼容 PSR-11。

特性

安装

快速开始

基本使用

属性注入

生命周期类型

类型 方法 说明
单例 singleton() 全局唯一实例
原型 prototype() 每次获取创建新实例
懒加载 lazy() 延迟实例化
上下文隔离 contextual() 协程/Fiber间隔离

上下文隔离

服务提供者

上下文绑定

标签

API 参考

Container

方法 说明
bind(id, concrete, lifecycle) 绑定服务
singleton(id, concrete) 绑定单例
prototype(id, concrete) 绑定原型
lazy(id, concrete) 绑定懒加载
contextual(id, concrete) 绑定上下文隔离
instance(id, instance) 绑定实例
alias(alias, id) 设置别名
extend(id, callback) 扩展服务
get(id) 获取服务
has(id) 检查服务是否存在
make(id, parameters) 创建实例
call(callback, parameters) 调用方法
resolved(id) 检查是否已解析
forget(id) 移除绑定
flush() 清空容器

Attributes

属性 目标 说明
#[Inject] Property, Parameter 标记注入点
#[Autowire] Class, Property, Method 启用自动装配
#[Singleton] Class 标记为单例
#[Prototype] Class 标记为原型
#[Contextual] Class 标记为上下文隔离

与其他 kode 组件集成

兼容性

PHP 版本 支持状态
PHP 8.1 ✅ 完全支持
PHP 8.2 ✅ 完全支持
PHP 8.3 ✅ 完全支持
PHP 8.4 ✅ 完全支持
PHP 8.5 ✅ 完全支持
框架 兼容性
Laravel ✅ 完全兼容
Symfony ✅ 完全兼容
ThinkPHP 8 ✅ 完全兼容
Webman ✅ 完全兼容
Hyperf ✅ 完全兼容
原生 PHP ✅ 完全兼容

测试

许可证

Apache License 2.0


All versions of di with dependencies

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

Loading the files please wait ...