瀏覽代碼

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 
 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 
 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
 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 
 The provided functionality is completely framework-independent but also contains a Laravel service provider for easy 
 integration into your Laravel project.
 integration into your Laravel project.
@@ -57,12 +57,12 @@ Add the facade to your `config/app.php` file:
 
 
 ```php
 ```php
 
 
-    'aliases'       => [
+    'aliases'       => array(
 
 
         //...
         //...
         'Curl'          => Ixudra\Curl\Facades\Curl::class,
         '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                              |
 | withContentType()     |  none             | Set the content type of the response                              |
 | containsFile()        |  false            | Should be used to submit files through forms                      |
 | 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)       |
 | 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              |
 | 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 
 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",
     "name": "ixudra/curl",
     "description": "Custom PHP Curl library for the Laravel 5 framework - developed by Ixudra",
     "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"],
     "keywords": ["Ixudra", "Laravel", "Curl"],
     "homepage": "http://ixudra.be",
     "homepage": "http://ixudra.be",
     "license": "MIT",
     "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
      * Set any specific cURL option
@@ -246,7 +244,7 @@ class Builder {
     {
     {
         return $this->withPackageOption( 'enableDebug', true )
         return $this->withPackageOption( 'enableDebug', true )
             ->withPackageOption( 'debugFile', $logFile )
             ->withPackageOption( 'debugFile', $logFile )
-            ->withOption('VERBOSE', true);
+            ->withOption( 'VERBOSE', true );
     }
     }
 
 
     /**
     /**