承接 tasoft/value-storage 相关项目开发

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

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

tasoft/value-storage

Composer 安装命令:

composer require tasoft/value-storage

包简介

README 文档

README

Is a simple storage to hold values and value providers.

Install

$ composer require tasoft/value-storage

Usage

The value storage can be used like a simple array.
In addition, it accepts values with a specific characteristic: They are resolvable on demand.

<?php
use TASoft\Util\ValueStorage;

$vp = new ValueStorage(["value1" => 23]);
$vp->value2 = 44;
$vp["value3"] = 'Hello World';

// The values are fetchable by properties or array access:
echo $vp->value3; // 'Hello World'
echo $vp["value1"]; // 23

This behaviour is not yet special.
But take a look at this:

<?php
use TASoft\Util\ValueStorage;

$vp = new ValueStorage(["test" => $func1 = function() { return 23; }]);
// or
$vp["other-test"] = $func2 = function() { return "Hello World"; };

// You can assign a callback using the constructor, a property name or by array access.

// Fetching the value provider is done by then get() method
echo $func1 === $vp->get('test'); // TRUE
// or
echo $func1 === $vp->test; // TRUE

// And fetching the real value is done by getValue or array access
echo $vp->getValue('test'); // 23
// or
echo $vp["test"]; // 23 !

In the same way like callbacks objects implementing TASoft\Util\Value\ValueInterface are working.

Passing an object implementing TASoft\Util\Value\ValueInterfaces injects the returned values from that object. You can assign such an object by any property or key or simply the addValue() method.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固