承接 webmgine/object-manager 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

webmgine/object-manager

Composer 安装命令:

composer require webmgine/object-manager

包简介

Static class to load objects with dependencies injection

README 文档

README

Static class to load objects with dependencies injection

Requirements

PHP >=7.4 This class need composer autoload

Getting Started

require <YOUR PROJECT DIR> . '/vendor/autoload.php';

To load an object, just call the getObject function and set namespace as string using / instead of \

use Webmgine\ObjectManager;
ObjectManager::getObject('Namespace/As/String');

or

\Webmgine\ObjectManager::getObject('Namespace/As/String');

Options

Custom arguments (data)

You can manually set arguments in a array using array key => construct var name association

namespace ExempleNamespace;

class ExempleClass{

    public function __construct(
        \ExempleNamespace\ExempleClass2 $demo1,
        string $demo2
    ) {
        // $demo1 -> Instance of \ExempleNamespace\ExempleClass2 class
        // $demo2 -> 'exemple text' (use custom argument from array associated by the array key and the var name)
    }
}
ObjectManager::getObject('ExempleNamespace/ExempleClass', ['data' => ['demo2' => 'exemple text']]);

Singletons (singleton)

You can set singleton to true, this will make the object manager return an existing object if any

ObjectManager::getObject('ExempleNamespace/ExempleClass', ['singleton' => true]);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固