承接 zingle-com/array-model 相关项目开发

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

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

zingle-com/array-model

最新稳定版本:1.0.2

Composer 安装命令:

composer require zingle-com/array-model

包简介

Model primitive arrays.

README 文档

README

Build Status Coverage Status

What and why?

Model associative array's as objects. This is useful when you would like some description of what is in associative array for future reference. Often times, in code you're also need to model certain kinds of behavior around data from various sources (api responses, arbitrary database queries, etc.).

Usage

Extend the ZingleCom\ArrayModel\AbstractModel class and add annotations to describe the kinds of data it models. Example:

use ZingleCom\ArrayModel\AbstractModel; /**  * @method int getId()  * @method string getUsername()  * @method bool isActive()  * @method array getFriends()  */ class SomeApiReponse extends AbstractModel {} // later in code // @var array $response $response = $httpClient->get('/user/123'); // $response suppose arr now contains an associative array like: // [ // 'id' => 123, // 'username' => 'bob', // 'active' => true, // 'friends' => [234, 345], // ] $model = new SomeApiResponse($response); echo $model->getId(); // prints 123 echo $model->getUsername(); // prints bob echo $model->isActive() ? 'YES' : 'NO'; // prints YES echo json_encode($model->getFriends()) // prints [234, 345]

Contributing

Open a PR against master. If you see any serious concerns email me at zach dot quintana at gmail dot com.

Happy coding!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固