@@ -27,6 +27,7 @@ public function post(
2727 $ request = $ this ->prepareRequest ($ url , $ urlParameters , $ headers );
2828
2929 curl_setopt ($ request , CURLOPT_POST , count ($ postParameters ));
30+
3031 if ($ asJSON === true ) {
3132 curl_setopt ($ request , CURLOPT_POSTFIELDS , json_encode ($ postParameters ));
3233 } else {
@@ -52,6 +53,53 @@ public function get($url, array $urlParameters = [], array $headers = [], $asJSO
5253 return $ this ->executeRequest ($ request );
5354 }
5455
56+ /**
57+ * Send a put request to a URL
58+ *
59+ * @param string $url
60+ * @param array $urlParameters
61+ * @param array $headers
62+ * @param bool $asJSON
63+ * @return void
64+ */
65+ public function put (
66+ $ url ,
67+ array $ urlParameters = [],
68+ array $ postParameters = [],
69+ array $ headers = [],
70+ $ asJSON = false
71+ ) {
72+ $ request = $ this ->prepareRequest ($ url , $ urlParameters , $ headers );
73+
74+ curl_setopt ($ request , CURLOPT_PUT , true );
75+
76+ if ($ asJSON === true ) {
77+ curl_setopt ($ request , CURLOPT_POSTFIELDS , json_encode ($ postParameters ));
78+ } else {
79+ curl_setopt ($ request , CURLOPT_POSTFIELDS , http_build_query ($ postParameters ));
80+ }
81+
82+ return $ this ->executeRequest ($ request );
83+ }
84+
85+ /**
86+ * Send a delete request to a URL.
87+ *
88+ * @param string $url
89+ * @param array $urlParameters
90+ * @param array $headers
91+ * @param bool $asJSON
92+ * @return Response
93+ */
94+ public function delete ($ url , array $ urlParameters = [], array $ headers = [], $ asJSON = false )
95+ {
96+ $ request = $ this ->prepareRequest ($ url , $ urlParameters , $ headers );
97+
98+ curl_setopt ($ request , CURLOPT_CUSTOMREQUEST , 'DELETE ' );
99+
100+ return $ this ->executeRequest ($ request );
101+ }
102+
55103 /**
56104 * Prepares a request using curl.
57105 *
0 commit comments