承接 jaytaph/typearray 相关项目开发

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

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

jaytaph/typearray

最新稳定版本:v0.0.5

Composer 安装命令:

composer require jaytaph/typearray

包简介

Typed Array

README 文档

README

Simple wrapper around property-accessor to fetch elements in a typed way. This package is created because I was fiddling around with a lot of json-arrays that were not typed and phpstan had a big issue with that.

So, instead of having mixed[] $myarray, we can use TypeArray, and fetch elements with:

$arr = new TypeArray(['foo' => 'string', 'bar' => 4 ]);

$arr->getString('[foo]');  // always returns a string
$arr->getString('[notexists]', 'defaultval');   // Returns default val when not found

$arr->getInt('[bar]');  // returns int(4)
$arr->getInt('[foo]');  // Returns InvalidTypeException as this element is a string, not an int

See symfony propertyaccess component for the path syntax used.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2022-12-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固