Giter Site home page Giter Site logo

manniru / php-serializable Goto Github PK

View Code? Open in Web Editor NEW

This project forked from theoomoregbee/php-serializable

0.0 1.0 0.0 639 KB

this helps to serialize php object

Home Page: http://www.phpclasses.org/package/10006-PHP-Automatic-serialization-of-objects-with-getters.html

License: GNU General Public License v3.0

PHP 100.00%

php-serializable's Introduction

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

Contributions

Allowed contributions to make it faster and re-usable

php-serializable's People

Contributors

theoomoregbee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.