Skip to content

A simplified class for the Curl commands in PHP

License

Notifications You must be signed in to change notification settings

fufu70/CurlClass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CurlClass

A simplification of the curl commands

This allows for a reusable templating structure that can accomodate most general needs.

Usage

To include the CurlClass in your composer file add the repo directory into your repositories section in the composer file and add the name of the module into the require section of the composer file.

"repositories": {
    ...
    { 
      "type": "vcs", 
      "url": "https://github.com/fufu70/CurlClass.git"
    }
    ...
}

...

"require": {
    ...
    "fufu70/curl-class": "dev-master",
    ...
}

To send a get Request pass the endpoint and the data to the Curl::get command

<?php

use Common\Curl;

$response = Curl::get(
  'https://example.com/endpoint'
  [
    'name' => 'value',
    'another_name' => 'another_value'
  ]
);

The post request (Curl::post) works excactly the same way, except for the function name.

<?php

use Common\Curl;

$response = Curl::post(
  'https://example.com/endpoint'
  [
    'name' => 'value',
    'another_name' => 'another_value'
  ]
);

About

A simplified class for the Curl commands in PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages