thevenrex/json-to-class
最新稳定版本:v1.0
Composer 安装命令:
composer require thevenrex/json-to-class
包简介
Json Class initializer
README 文档
README
Json Decoder into class
First step
use Thevenrex\JsonToClass\JsonToClassDecoder;
Usage
Create Class with public methods to used in json same
class User { public int $id; public string $name; public string $username; }
Create a new instance of JSON class with json raw
$json = '{ "id": 1, "name": "John Doe", "username": "johndoe" }'; $decoder = new JsonToClassDecoder($rawJson);
Decode content
$user = new User(); $decoder->decode($user);
The attributes is changed with json Datas
var_dump($user);
example output:
class User#3 (3) {
public int $id =>
int(1)
public string $name =>
string(5) "John Doe"
public string $username =>
string(10) "johndoe"
}
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-30