2017 © Pedro Peláez
 

library simplecurl

A very simple and minimalistic cURL wrapper for Laravel 4

image

passioncoder/simplecurl

A very simple and minimalistic cURL wrapper for Laravel 4

  • Tuesday, January 20, 2015
  • by passioncoder
  • Repository
  • 3 Watchers
  • 7 Stars
  • 590 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 3 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

SimpleCurl for Laravel 4

A very simple and minimalistic cURL wrapper for Laravel 4., (*1)

Why?

There are a lot of great php HTTP clients out there in the wild. But sometimes you don't want/need the overhead of a full-featured client which forces you to write 15 lines of code to load a RSS feed or retrive data from an REST API., (*2)

$response = Curl::get('http://example.com/data.json');

SimpleCurl is the easy one-liner for this purpose. It's not intended to become the next guzzle, nor will it replace the Zend Http Client. ;), (*3)

Install

Composer:, (*4)

Add passioncoder/simplecurl to the require section of your composer.json:, (*5)

"require": {
    "passioncoder/simplecurl": "dev-master"
}

Laravel:, (*6)

Add the service provider to your app/config/app.php:, (*7)

'providers' => array(

    'Passioncoder\SimpleCurl\ServiceProvider',
),

Add the alias to your app/config/app.php (optional):, (*8)

'aliases' => array(

    'Curl'            => 'Passioncoder\SimpleCurl\Facade',
),

Usage

Synopsis:, (*9)

$response = Curl::get($url, [array $params, [array $options]]);
$response = Curl::post($url, [array $params, [array $options]]);
  • $url: A valid url
  • $params: The get/post parameters as key/value pairs
  • $options: cURL options as as key/value pairs

Example:, (*10)

try {

    $response = Curl::get('http://example.com/data.json', ['foo' => 'bar'], [CURLOPT_HEADER => false]);

} catch (Passioncoder\SimpleCurl\Exception $e) {

    print $e->getMessage();
}

var_dump($response->header);
var_dump($response->body);

if ($response->header->http_code == 200) {

    print 'yeah!';
}

License

This package is open-sourced software licensed under the MIT license., (*11)

The Versions

20/01 2015

dev-master

9999999-dev

A very simple and minimalistic cURL wrapper for Laravel 4

  Sources   Download

MIT

The Requires

 

by Georg Gradwohl

laravel curl php

07/12 2014

0.1.2

0.1.2.0

A very simple and minimalistic cURL wrapper for Laravel 4

  Sources   Download

MIT

The Requires

 

by Georg Gradwohl

laravel curl php

05/09 2014

0.1.1

0.1.1.0

A very simple and minimalistic cURL wrapper for Laravel 4

  Sources   Download

MIT

The Requires

 

by Georg Gradwohl

laravel curl php

01/09 2014

0.1.0

0.1.0.0

A very simple and minimalistic cURL wrapper for Laravel 4

  Sources   Download

MIT

The Requires

 

by Georg Gradwohl

laravel curl php