theophy/php-serializable
Composer 安装命令:
composer require theophy/php-serializable
包简介
this helps to serialize php object
README 文档
README
this helps to serialize php object
how to
to use it call the static method called serilaizable which will take in the obect as parameter. see example below
$user = new User();
$user->setFirstname("Theophilus");
$user->setLastname("Omoregbee");
$user->setStates(array(new State("Edo state", "ED"), new State("Lagos State", "LG")));
$user->setCountry(new Country("Nigeria","NG"));
$user->setRoles(array("ADMIN","DB MANAGER"));
$user->setEmail("theo4u@ymail.com");
$user->setPassword("1111");
//lets serialize our object now
echo json_encode(SerializeMe::serialize($user));
which will lead to this output
{"firstname":"Theophilus","lastname":"Omoregbee","states":[{"name":"Edo state","code":"ED"},{"name":"Lagos State","code":"LG"}],"country":{"name":"Nigeria","code":"NG"},"dateCreated":1477351778,"roles":["ADMIN","DB MANAGER"],"email":"theo4u@ymail.com","password":"b59c67bf196a4758191e42f76670ceba"}
Contributions
Allow contributions to make it faster and re-usable
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2016-12-02
