Pārlūkot izejas kodu

More descritive functions

Luiz Guilherme Fonseca Rosa 8 gadi atpakaļ
vecāks
revīzija
ec46862c8f
1 mainītis faili ar 59 papildinājumiem un 33 dzēšanām
  1. 59 33
      README.md

+ 59 - 33
README.md

@@ -20,6 +20,9 @@ Pull this package in through Composer.
 
 ```
 
+or run in terminal:
+`composer require ixudra/curl`
+
 
 ### Laravel 5.* Integration
 
@@ -140,22 +143,28 @@ method.
 In order to send a `GET` request, you need to use the `get()` method that is provided by the package:
 
 ```php
+use Ixudra\Curl\Facades\Curl;
 
-    // Send a GET request to: http://www.foo.com/bar
-    $response = Curl::to('http://www.foo.com/bar')
-        ->get();
-
-    // Send a GET request to: http://www.foo.com/bar?foz=baz
-    $response = Curl::to('http://www.foo.com/bar')
-        ->withData( array( 'foz' => 'baz' ) )
-        ->get();
+class Foo
+{
+    public function bar ()
+    {
+        // Send a GET request to: http://www.foo.com/bar
+        $response = Curl::to('http://www.foo.com/bar')
+            ->get();
 
-    // Send a GET request to: http://www.foo.com/bar?foz=baz using JSON
-    $response = Curl::to('http://www.foo.com/bar')
-        ->withData( array( 'foz' => 'baz' ) )
-        ->asJson()
-        ->get();
+        // Send a GET request to: http://www.foo.com/bar?foz=baz
+        $response = Curl::to('http://www.foo.com/bar')
+            ->withData( array( 'foz' => 'baz' ) )
+            ->get();
 
+        // Send a GET request to: http://www.foo.com/bar?foz=baz using JSON
+        $response = Curl::to('http://www.foo.com/bar')
+            ->withData( array( 'foz' => 'baz' ) )
+            ->asJson()
+            ->get();
+    }
+}
 ```
 
 
@@ -169,7 +178,7 @@ use Ixudra\Curl\Facades\Curl;
 class Foo
 {
     public function bar ()
-        {
+    {
         // Send a POST request to: http://www.foo.com/bar
         $response = Curl::to('http://www.foo.com/bar')
             ->post();
@@ -190,9 +199,8 @@ class Foo
             ->withData( array( 'foz' => 'baz' ) )
             ->asJson( true )
             ->post();
-        }
+    }
 }
-
 ```
 
 
@@ -201,13 +209,19 @@ class Foo
 Put requests work similar to `POST` requests, but use the `put()` method instead:
 
 ```php
+use Ixudra\Curl\Facades\Curl;
 
-    // Send a PUT request to: http://www.foo.com/bar/1 with arguments 'foz' = 'baz' using JSON
-    $response = Curl::to('http://www.foo.com/bar/1')
-        ->withData( array( 'foz' => 'baz' ) )
-        ->asJson()
-        ->put();
-
+class Foo
+{
+    public function bar ()
+    {
+        // Send a PUT request to: http://www.foo.com/bar/1 with arguments 'foz' = 'baz' using JSON
+        $response = Curl::to('http://www.foo.com/bar/1')
+           ->withData( array( 'foz' => 'baz' ) )
+           ->asJson()
+           ->put();
+    }
+}
 ```
 
 
@@ -216,13 +230,19 @@ Put requests work similar to `POST` requests, but use the `put()` method instead
 Patch requests work similar to `POST` requests, but use the `patch()` method instead:
 
 ```php
+use Ixudra\Curl\Facades\Curl;
 
-    // Send a PATCH request to: http://www.foo.com/bar/1 with arguments 'foz' = 'baz' using JSON
-    $response = Curl::to('http://www.foo.com/bar/1')
-        ->withData( array( 'foz' => 'baz' ) )
-        ->asJson()
-        ->patch();
-
+class Foo
+{
+    public function bar ()
+    {
+        // Send a PATCH request to: http://www.foo.com/bar/1 with arguments 'foz' = 'baz' using JSON
+        $response = Curl::to('http://www.foo.com/bar/1')
+            ->withData( array( 'foz' => 'baz' ) )
+            ->asJson()
+            ->patch();
+    }
+}
 ```
 
 
@@ -231,12 +251,18 @@ Patch requests work similar to `POST` requests, but use the `patch()` method ins
 Delete requests work similar to `GET` requests, but use the `delete()` method instead:
 
 ```php
+use Ixudra\Curl\Facades\Curl;
 
-    // Send a DELETE request to: http://www.foo.com/bar/1 using JSON
-    $response = Curl::to('http://www.foo.com/bar/1')
-        ->asJson()
-        ->delete();
-
+class Foo
+{
+    public function bar ()
+    {
+        // Send a DELETE request to: http://www.foo.com/bar/1 using JSON
+        $response = Curl::to('http://www.foo.com/bar/1')
+            ->asJson()
+            ->delete();
+    }
+}
 ```