It's just an ordinary helper which help you using curl feature in your PHP project. This is independent repo, so this is flexible to use in any framework. Just install and use you will smile because you was helped with this.
composer require bni/curl
This is a minimum code to using this package
<?php
include '/vendor/autoload.php';
use BNI\Curl;
class YourController {
public function yourFunction() {
$request = Curl::get()
->url('https://api.facebook.com/v1/users/test')
->header([
['apiKey' => '123456'],
['serverKey' => 'asd9uwe'],
])
->eksekusi();
return $request;
}
}
Function | Usage |
---|---|
get(null ) |
initialize get request |
post(null ) |
initialize post request |
url(string ) |
set URL / endpoint |
parameter(array ) |
set URL parameters |
header(array ) |
set headers request |
body(array ) |
post form field |
timeout(integer ) |
maximum number of seconds for curl to execute |
options(string $optionName, depending optname $optionValue) |
set your own options |
eksekusi(null ) |
run your request |
...
->parameter([
['email' => 'hello@google.com']
])
...
Feel free to make a big change to this repository. It will help lots of people who didn't know about using curl natively in PHP or someone who don't want use complex built-in function and it will speed up his work.
Make new branch and create new pull request will be your big step.
You can contact me about this repository via telegram on @haloriyan