objective-php/services-factory 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

objective-php/services-factory

Composer 安装命令:

composer require objective-php/services-factory

包简介

Services container for Objective PHP

README 文档

README

Description

Services Factory is an attempt to handle dependencies injection in an easier and more readable way compared to other available implementations.

The main main focus of this component is put on:

  • reducing the code and configuration needed for DI mechanism
  • preserving code-insight for components built and getting their dependencies injected

The Services Factory is split in several components. Understanding each of these helps a lot in understanding the whole logic of the component:

  • Service Specifications
    • defined by ObjectivePHP\ServicesFactory\Specification\ServiceSpecificationInterface
    • this how the service definitions are normalized, so that the Factory understands them
    • there are two default specs types provided with the component:
      • PrefabServiceSpecification
        • the most simple services ever!
        • stores a pre-instantiated object (or any other value)
      • ClassServiceSpecification
        • this one allow to define a class as template of a service
        • can get constructor arguments ("params" property)
        • optional dependencies can be set using setters ("setters" property)
        • is autowired by default
    • both types require an "id" parameter
    • the latter also supports a "static" property, to indicate whether the same instance should be returned each time the service is requested or not
  • Service Builders
    • associated to the ServiceSpecs types, builders are in charge of actually building the service according to its specs
    • there also two builders bundled with the component, one for each type:
      • PrefabServiceBuilder
      • ClassServiceBuilder
  • Factory
    • central object, it's used to register either service specs and builders
    • once setup, the Factory provide the application with services through its get(string $serviceId)method

Documentation

The component documentation is located in the docs subfolder

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2015-08-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固