定制 technically/dependency-resolver 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

technically/dependency-resolver

Composer 安装命令:

composer require technically/dependency-resolver

包简介

Dependency-resolver utility based on PSR-11 container to be used for auto-wiring.

README 文档

README

Technically\DependencyResolver is a simple yet powerful tool to instantiate classes autowiring their dependencies by resolving them from a PSR-11 container or recursively instantiating them with DependencyResolver itself.

Status

Features

  • Based on PSR-11
  • Supports modern PHP 8 features — union types, null and false type hints, and others.
  • Recursive dependencies autowiring
  • Semver
  • Tests

Installation

Use Composer package manager to add Technically\DependencyResolver to your project:

composer require technically/dependency-resolver

Example

<?php

final class MyFancyService 
{
    public function __construct(callable|LoggerInterface $log) 
    {
        // initialize
    }
}

// Construct a service instance, providing dependencies in-place:
$resolver = new DependencyResolver();
$service = $resolver->construct(MyFancyService::class, [
    'log' => function (string $priority, string $message) {
        error_log("[$priority]: $message");
    }]
);

// Resolve service instance from container, falling back to `construct()` otherwise.
$resolver = new DependencyResolver($container);
$service = $resolver->resolve(MyFancyService::class);

Changelog

All notable changes to this project will be documented in the CHANGELOG file.

Credits

统计信息

  • 总下载量: 126
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固