Переглянути джерело

New version for cookie management

Jan Oris 8 роки тому
батько
коміт
fb4d7bc42d
3 змінених файлів з 27 додано та 27 видалено
  1. 5 3
      README.md
  2. 1 1
      composer.json
  3. 21 23
      src/Builder.php

+ 5 - 3
README.md

@@ -6,7 +6,7 @@ Custom PHP cURL library for the Laravel 4 or 5 framework - developed by [Ixudra]
 The package provides an easy interface for sending cURL requests from your PHP web application. The package provides an 
 intuitive, fluent interface similar the Laravel query builder to easily configure the request. Additionally, There are 
 several utility methods that allow you to easily add certain options to the request. This makes it easier to create and
-use cURL requests and also makes your code more readible and comprehensible.
+use cURL requests and also makes your code more comprehensible.
 
 The provided functionality is completely framework-independent but also contains a Laravel service provider for easy 
 integration into your Laravel project.
@@ -57,12 +57,12 @@ Add the facade to your `config/app.php` file:
 
 ```php
 
-    'aliases'       => [
+    'aliases'       => array(
 
         //...
         'Curl'          => Ixudra\Curl\Facades\Curl::class,
 
-    ],
+    ),
 
 ```
 
@@ -361,6 +361,8 @@ any validation on the cURL options. Additional information about available cURL
 | withContentType()     |  none             | Set the content type of the response                              |
 | containsFile()        |  false            | Should be used to submit files through forms                      |
 | withData()            |  array()          | Add an array of data to sent with the request (GET or POST)       |
+| setCookieFile()       |  none             | Set a file to store cookies in                                    |
+| setCookieJar()        |  none             | Set a file to read cookies from                                   |
 | withOption()          |  none             | Generic method to add any cURL option to the request              |
 
 For specific information regarding parameters and return types, I encourage you to take a look at 

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
     "name": "ixudra/curl",
     "description": "Custom PHP Curl library for the Laravel 5 framework - developed by Ixudra",
-    "version": "6.8.1",
+    "version": "6.9.0",
     "keywords": ["Ixudra", "Laravel", "Curl"],
     "homepage": "http://ixudra.be",
     "license": "MIT",

+ 21 - 23
src/Builder.php

@@ -135,28 +135,26 @@ class Builder {
     }
 
     /**
-	 * Set Cookie File
-	 *
-	 * @param string $cookie_file file name to read cookies from
-	 *
-	 * @return Builder
-	 */
-	public function setCookieFile($cookie_file)
-	{
-		return $this->withOption('CURLOPT_COOKIEFILE', $cookie_file);
-	}
-
-	/**
-	 * Set Cookie Jar
-	 *
-	 * @param string $cookie_jar file name to store cookies to
-	 *
-	 * @return Builder
-	 */
-	public function setCookieJar($cookie_jar)
-	{
-		return $this->withOption('CURLOPT_COOKIEJAR', $cookie_jar);
-	}
+     * Set Cookie File
+     *
+     * @param   string $cookieFile  File name to read cookies from
+     * @return Builder
+     */
+    public function setCookieFile($cookieFile)
+    {
+        return $this->withOption( 'COOKIEFILE', $cookieFile );
+    }
+
+    /**
+     * Set Cookie Jar
+     *
+     * @param   string $cookieJar   File name to store cookies to
+     * @return Builder
+     */
+    public function setCookieJar($cookieJar)
+    {
+        return $this->withOption( 'COOKIEJAR', $cookieJar );
+    }
     
     /**
      * Set any specific cURL option
@@ -246,7 +244,7 @@ class Builder {
     {
         return $this->withPackageOption( 'enableDebug', true )
             ->withPackageOption( 'debugFile', $logFile )
-            ->withOption('VERBOSE', true);
+            ->withOption( 'VERBOSE', true );
     }
 
     /**