承接 gidato/laminas-container-extensions 相关项目开发

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

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

gidato/laminas-container-extensions

Composer 安装命令:

composer require gidato/laminas-container-extensions

包简介

Extensions Laminas Service Manager to implement Container Extensions (eg nested containers, cached instances with options)

README 文档

README


composer require gidato/laminas-container-extensions

You then need to find the following line in \config\container.php

use Laminas\ServiceManager\ServiceManager;

And change it as follows:

use Gidato\ContainerExtensions\Laminas;

Nested Containers

A separate container can be created and used within a container, effectively namespacing the bound elements.

This allows specific parts of the application to be directly associated with a specific container.

To access sub containers, you can use $container->container("name-of-container"), and then bind things to this level.

Cached Objects Which Use Options To Build

Rather than using $container->get('name'), you can use $container->getWith('name', ['options']). This will create the object using the options passed, but will return exactly the same instance on subsequent request with the same options providing the object is defined as shared, or the default is shared.

Getting New Instances

Rather than using build(), you should use create() and createWith() to allow the package to be used with other container implementations.

Getting Everything From A Container

You can get all keys within a container, or all instances.

public function getKeys(bool $includeContainer = false, bool $includeAliases = false);

$container->getKeys(); // returns all keys, but excludes containers and aliases
$container->getKeys(true); // returns all keys including containers, but excludes aliases
$container->getKeys(false, true); // returns all keys including aliases but excludes containers
$container->getKeys(true, true); // returns all keys including containers and aliases

Or get all instances (index by the key). These will be built if not already.

public function getAll(bool $includeContainer = false);

$container->getAll(); // returns all instances, but excludes containers
$container->getAll(true); // returns all instances, and includes containers

License

This software is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固