Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theoomoregbee/php-serializable
this helps to serialize php object
https://github.com/theoomoregbee/php-serializable
class iterator oop php php-serializable recursive serialization
Last synced: 2 months ago
JSON representation
this helps to serialize php object
- Host: GitHub
- URL: https://github.com/theoomoregbee/php-serializable
- Owner: theoomoregbee
- License: gpl-3.0
- Created: 2016-10-24T22:38:31.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-08T09:37:55.000Z (almost 8 years ago)
- Last Synced: 2024-10-12T01:16:16.831Z (3 months ago)
- Topics: class, iterator, oop, php, php-serializable, recursive, serialization
- Language: PHP
- Homepage: http://www.phpclasses.org/package/10006-PHP-Automatic-serialization-of-objects-with-getters.html
- Size: 624 KB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-serializable
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("[email protected]");
$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":"[email protected]","password":"b59c67bf196a4758191e42f76670ceba"}`![Response Json](https://github.com/theo4u/php-serializable/raw/master/serializable.png)
## Contributions
Allow contributions to make it faster and re-usable