Download the PHP package sesser/scurl without Composer

On this page you can find all versions of the php package sesser/scurl. 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 scurl

Scurl

Build Status

Scurl is an easy to use PHP library for making HTTP requests. It requires PHP >= 5.4 and the curl extension. The library is PSR-0 compliant and includes a composer file for easy inclusion in your project.

How To Include

With Composer

Add the following to your composer.json file in your project:

Then make sure you include your vendor/autoload.php file.

Without Composer

Quick How To

Scurl is pretty basic. It supports the major calls (GET, POST, PUT, DELETE, HEAD). At it's most basic level, you can make a GET request like so

For more complex calls like PUTting objects to servers:

PUTting json data (and presumably xml data, though untested) is possible too:

Events

Scurl supports basic events too so you can make modifications to the Request object before it sends the request off. Or, you can modify/read the Response after the request has been sent. This could be useful for logging requests or keeping track of the time it takes to get a response from a server.

Currently, there's only two events called; Scurl::EVENT_BEFORE and Scurl::EVENT_AFTER. They are called before the request is sent and after the response is received, respectively. The events are a in a stack and called from top to bottom (first in, first called) so you can assign more than one callback to an event. See the example below:

The Scurl::addListener method returns the pointer for this event callback. If, for some reason, you want to remove the listener from the call stack, just call the Scurl::removeListener method.

Please note that if the event passed to addListener is not a valid event or the callback is not callable, addListener will return false indicating that failed to register the event. Also, there is one other event that hasn't been implemented yet; Sesser\Scurl\Scurl::EVENT_ERROR. This event will be available soon and called when there is an error at the curl level. the method signature should look like this:

The Long Story

Scurl is just a wrapper to the Request class which does most of the heavy lifting. When you instantiate a Scurl object, you can pass an array of configuration options. These options persist for all calls made with that object unless you override them in a specific call. The configuration passed to the __construct is merged with the defaults shown below:

Configuration Explained

$defaults['method']: The HTTP Method. This is generally overridden with every request, but you can set a default if you want.

$defaults['auth']: You can add your authentication credentials here or on a per-request basis by simply adding it to the $url (a la http://<user>:<pass>@somehost.com)

$defaults['data']: This is used for PUT requests

$defaults['parameters']: Default parameters to pass in the request

$defaults['cookie']: Set this to pass a cookie in the request. This is either a key/value pair array or a string value ('foo=bar; uid=1234')

$defaults['headers']: Headers sent in the request.

$defaults['options']: General options


All versions of scurl with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
lib-curl Version *
lib-openssl Version *
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 sesser/scurl contains the following files

Loading the files please wait ....