Download the PHP package weilun/wlcurl without Composer

On this page you can find all versions of the php package weilun/wlcurl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wlcurl

WLCURL

Let PHP Api (CURL) request more easyly、clearly、liberty and modelly
讓 PHP Api (CURL) 請求更加簡單、清楚易懂、自由、模組化

Installation - 安裝

Quick Example - 快速範例

Same as - 如下同上

Same as - 如下同上

Same as above but modelly - 如下同上但模組化

Reach result and error handle

Construct - 構成式

method

There are already have multiple default function to help you to set curl method
已經有許多默認函式提供讓你去設置請求 curl 的method

Customize method - 客製方法

base_url

As we all knows, URL is the most important foundation of the CURL request. And basic url is the first section of the url
眾所周知, 網址是 curl 請求最重要的一環, 而 basic url 是組成網址的第一個部分

end_point

_endpoint is the second section of the url, reach your target node
> _endpoint 是組成網址的第二個部分, 觸及你的目標節點

If you want to add end point node, put true in second parameter 如果你想要壘加目標節點, 在第二個參數放上 true

url_para

_urlpara is the third section of the url, pass your requirement parameter to api server
> _urlpara 是組成網址的第三個部分, 傳送你所需的參數給目標 api 伺服器

It will generate like _'?page=1&pagesize=24' string
這會生成像是 _'?page=1&pagesize=24' 的字串

body

Pass your requirement post field parameter to api server
傳送你所需的 post field 參數給目標 api 伺服器

header

It will build header structure like ["Cache-Control: no-cache"]

token

token_type

It will put _tokentype value in front of token as soon as build token. Defualt value is "Bearer"
在組建 token 參數時, 會將_tokentype值擺在前面


If you want to set token manually
如果你想手動設置 token

para_type

It will effect the body parameter formation as soon as build curl request.
The default value is "http".
The value only accept in ["http", "json"].
If value equal "http", WLCURL will format body as build_http_query_para.
If value equal "json", WLCURL will format body as json_encode, and set curl header Content-Type as "application/json" automatically.
此參數會直接影響 curl 請求時body參數轉換的形式
預設值是"http".
參數容許值只在["http", "json"]裡面.
如果參數設為"http", WLCURL 會將 body參數設為 build_http_query_para.
如果參數設為"json", WLCURL 會將 body參數設為 json_encode, 並且會自動將 curl header Content-Type 參數設為 "application/json"

opt

Set PHP original curl opt parameter, you can find referance in PHP CURL setopt
設置 PHP 原生 curl opt 參數, 你可以參照此處PHP CURL setopt

Execute - 執行

exe

WLCURL will do request task as soon as you call exe() function, and WLCURL will not do anything before you call it.
> WLCURL 會在執行 exe() 函式時執行請求任務. WLCURL 不會在你呼叫此函式前做任何事.

Error Handle - 錯誤處理

WLCURL is already prepare multiple function to help you handle your error. It only has meaning after exe()

WLCURL 已經準備好許多函式來幫助你處理錯誤狀況. 這只會在執行 exe() 後有意義

is_error

check curl request result return first section http status code is in 4 or 5
Return type boolean
檢查 curl 請求結果回傳的 http 狀態碼第一字節是否是 45
回傳型態 boolean

is_client_error

check curl request result return first section http status code is 4 or not
Return type boolean
檢查 curl 請求結果回傳的 http 狀態碼第一字節是否是 4
回傳型態 boolean

is_bad_request

check curl request result return http status code is 400 or not
Return type boolean
檢查 curl 請求結果回傳的 http 狀態碼是否是 400
回傳型態 boolean

is_unauthorized

check curl request result return http status code is 401 or not
Return type boolean
檢查 curl 請求結果回傳的 http 狀態碼是否是 401
回傳型態 boolean

is_forbidden

check curl request result return http status code is 403 or not
Return type boolean
檢查 curl 請求結果回傳的 http 狀態碼是否是 403
回傳型態 boolean

is_method_not_allow

check curl request result return http status code is 405 or not
Return type boolean
檢查 curl 請求結果回傳的 http 狀態碼是否是 405
回傳型態 boolean

is_server_error

check curl request result return first section http status code is 5 or not
Return type boolean
檢查 curl 請求結果回傳的 http 狀態碼第一字節是否是 5
回傳型態 boolean

get_Http_code

Retrieve raw http status code 取得原生 http 回傳之狀態碼

get_error_msg

Retrieve the error msg from php original curl 取得 PHP 原生 curl 請求錯誤的錯誤訊息

get_info

Retrieve full request info from PHP original curl 取得所有 PHP 原生 curl 請求的回傳訊息

Get Request Result - 取得請求結果

It only has meaning after exe().
只有在呼叫exe()函式後有意義.

getBody

Get raw request result body.
取得原始請求後的 body 結果.

getdecodeBody

Get request result body that after json_decode.
取得請求後的 json_decode body 結果.

You may want to handle error before retrieve body
你也許會想要在取得結果前做錯誤處理

Modelly-Best Advance Practice - 模組化-最佳進階做法

Make your own packaged curl model.
製作屬於你自己的 curl 請求模組類別

File Structure - 檔案結構

Models
|- MyApiServerApi (extends WLCURL)
|- Order
|-- OrderApi (extends MyApiServerApi)
|-- OrderProductApi (extends MyApiServerApi)

MyApiServerApi

Make your own target api server model class.
You can set any solid required curl parameter in this model constructor. And you don't have to do this again.
製作你自己的目標 api 請求模組類別.
你可以設置任何請求前所需的目標參數在構成式裡, 你將不需要再做一次.

TargetApi

Make your own target end point model class. And package your api function.
製作你自己的目標節點請求 api 模組類別. 並打包函式方便日後使用.

You can use TargetApi (OrderApi) like
你可以使用 TargetApi (OrderApi) 就像


All versions of wlcurl with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package weilun/wlcurl contains the following files

Loading the files please wait ....