定制 naoki-tsuchiya/ray-di-psr-container 二次开发

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

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

naoki-tsuchiya/ray-di-psr-container

最新稳定版本:v0.1.0

Composer 安装命令:

composer require naoki-tsuchiya/ray-di-psr-container

包简介

An implementation of PSR-11 container for Ray.Di

README 文档

README

Continuous-Integration codecov

naoki-tsuchiya/ray-di-psr-container is a package that implements the PSR-11 (ContainerInterface) and integrates seamlessly with Ray.DI. This library leverages the dependency injection capabilities of Ray.DI while providing a PSR-11 compatible interface.

Installation

composer require naoki-tsuchiya/ray-di-psr-container

Usage

<?php

use NaokiTsuchiya\RayDiPsrContainer\PsrContainer;
use NaokiTsuchiya\RayDiPsrContainer\IdentityStringGenerator;
use Ray\Di\Injector;

require_once 'vendor/autoload.php';

// Create an Injector
$injector = new Injector(new FooModule());

// Create a Psr11Injector
$container = new PsrContainer($injector);

// Retrieve an instance
$instance = $container->get(FooInterface::class);

// Check if a binding exists
$isAvailable = $container->has(FooInterface::class);

// Using get() method with IdentityStringGenerator
// Compatible with Injector's getInstance method.
$namedInstance = $container->get(IdentityStringGenerator::generate(Foo::class, NAME::class));

Development

Install

composer install

Available Commands

composer test              // Run unit test
composer tests             // Test and quality checks
composer cs                // Run coding style check
composer cs-fix            // Fix the coding style
composer sa                // Run static analysis tools
composer run-script --list // List all available commands

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-05