diff options
author | purplecode <niespammnie@gmail.com> | 2013-12-11 17:00:05 +0100 |
---|---|---|
committer | purplecode <niespammnie@gmail.com> | 2013-12-11 17:00:05 +0100 |
commit | 9d0d9ea45aeedf531729680f9ce1d1141d308855 (patch) | |
tree | e2b11479299529ac9cf582bff5d9d922cf2ed970 | |
parent | 64edc0e6d5e146dbe56b846677b2e2ff31eb371f (diff) | |
download | php.curl-9d0d9ea45aeedf531729680f9ce1d1141d308855.zip php.curl-9d0d9ea45aeedf531729680f9ce1d1141d308855.tar.gz php.curl-9d0d9ea45aeedf531729680f9ce1d1141d308855.tar.bz2 |
Update README.md
-rw-r--r-- | README.md | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -22,6 +22,8 @@ or just copy-paste content of `src/` to your `libs`. Usage ------------ +### PCurl.php + Simple GET ``` $pcurl = new PCurl('http://www.google.pl'); @@ -51,4 +53,23 @@ $pcurl->contentType('application/xml'); $response = $pcurl->post('/igipigiel/xml', '<a>makapaka</a>'); ``` +### PJsonCurl.php + +Class similar to PCurl, the only difference is that the input/output is passed through json_encode/json_decode. +``` +$pcurl = new PJsonCurl('http://www.app.com/json'); +$response = $pcurl->put('/', array('a' => 'b')); +echo $response['c']; +``` + +### PObjectCurl.php + +Class similar to PJsonCurl, the difference is that the input/output is passed through serialize/deserialize methods. Requires [JMS\Serializer](https://github.com/schmittjoh/serializer) library or [JMSSerializerBundle](https://github.com/schmittjoh/JMSSerializerBundle) Symfony2 bundle. + +``` +$pcurl = new PObjectCurl('http://www.prettifier.com/json', JMS\Serializer\SerializerInterface $serializer); +$pcurl->responseClass('My\App\Preety'); +$uglyObject = new My\App\Ugly(); +$preetyObject = $pcurl->put('/', $uglyObject); +``` Enjoy! |