定制 darkknightik/nette-injects-extension 二次开发

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

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

darkknightik/nette-injects-extension

最新稳定版本:v0.1.0

Composer 安装命令:

composer require darkknightik/nette-injects-extension

包简介

Nette Framework DI extension for injecting services into other services' properties.

README 文档

README

Nette Framework DI extension for injecting services into other services' properties.

Motivation

Writing constructor/setter injection is sometimes annoyingand while developing, it may eat a lot of time. Also it is simpler to not bother with explicit injection as long as it is not needed (e.g. in small application, not public project etc.).

Requirements

  • PHP 5.3.1 or newer
  • Nette 2.3 or newer

Installation

  1. Add "majkl578/nette-injects-extension" to your dependencies in composer.json. Don't forget to run composer update.

  2. Register this DI extension as last one in your configuration file in extensions section

    injects: Majkl578\NetteAddons\Injects\DI\Extension\InjectsExtension
    
  3. Delete cache.

You're done. ;)

Usage

All types of instance properties are supported - public, protected as well as private. You can also inject a set of classes of a type, e.g. all implementers of an interface. Also works well with namespaced code and uses.

class Foo
{
	/**
	 * @inject
	 * @var Foo
	 */
	public $foo;

	/**
	 * @inject
	 * @var Bar
	 */
	protected $bar;

	/**
	 * @inject
	 * @var Baz
	 */
	private $baz;

	/**
	 * @inject
	 * @var IWatcher[]
	 */
	 protected $watchers;
}

Issues

In case of any problems, just leave an issue here on GitHub (or, better, send a pull request).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固