Last Updated: February 25, 2016
·
2.559K
· lastguest

PHP: Chainable cURL Object Oriented API

In my Chainable post :
https://coderwall.com/p/dmuoqa

I got some requests for an example of a pratical use of the method chaining wrapper.

Remember the cURL Object Oriented API Class?
https://coderwall.com/p/f9qjvw

Let's combine them into a
dynamic-chainable-object-oriented-api! ;)

(new Chainable(
      new cURL("http://graph.facebook.com/CaffeinaLab")
 )) -> setopt(CURLOPT_HEADER, 0)
    -> setopt(CURLOPT_RETURNTRANSFER, 1)
    -> exec() -> _get_return($data)
    -> close()
;

print_r( json_decode( $data ) );

1 Response
Add your response

huh! that explains it I guess. I'll give it a bash and try creating a chainable method on my own and let you know if I have any further confusions. thanks man, appreciate your response. :)

over 1 year ago ·