better support without using composer

This commit is contained in:
thefosk
2013-04-29 11:18:37 -07:00
parent 22d0c7cbfb
commit e40bd96285
6 changed files with 17 additions and 6 deletions

View File

@@ -30,6 +30,12 @@ And then run:
php composer.phar install
```
Include the library in your project with:
```php
require 'vendor/autoload.php';
````
### Creating Request
So you're probably wondering how using Unirest makes creating requests in PHP easier, let's look at a working example:

7
lib/Unirest.php Normal file
View File

@@ -0,0 +1,7 @@
<?php
require(dirname(__FILE__) . '/Unirest/HttpMethod.php');
require(dirname(__FILE__) . '/Unirest/HttpResponse.php');
require(dirname(__FILE__) . '/Unirest/Unirest.php');
?>

View File

@@ -1,6 +1,4 @@
<?php
namespace Unirest;
class HttpMethod
{
const DELETE = "DELETE";

View File

@@ -1,6 +1,4 @@
<?php
namespace Unirest;
class HttpResponse
{
private $code;

View File

@@ -1,6 +1,4 @@
<?php
namespace Unirest;
class Unirest
{
/**

4
prova.php Normal file
View File

@@ -0,0 +1,4 @@
<?php
require 'vendor/autoload.php';
var_dump(Unirest::post("http://google.com"));
?>