Skip to content

Commit 1bf3f18

Browse files
committed
Add description how install php-http-client manually
1 parent 929018c commit 1bf3f18

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

README.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,57 @@ Then from the command line:
3838
composer install
3939
```
4040

41+
## Install without Composer
42+
43+
You should create directory `lib` in directory of your application and clone to `lib` repositories [php-http-client](https://github.com/sendgrid/php-http-client.git) and [sendgrid-php](https://github.com/sendgrid/sendgrid-php.git):
44+
45+
```
46+
$ cd /path/to/your/app
47+
$ mkdir lib
48+
$ cd lib
49+
$ git clone https://github.com/sendgrid/php-http-client.git
50+
$ git clone https://github.com/sendgrid/sendgrid-php.git
51+
```
52+
53+
In the next step you shoud create `loader.php`:
54+
55+
```
56+
$ cd /path/to/your/app
57+
$ touch loader.php
58+
```
59+
60+
And add to `loader.php` code below:
61+
62+
```php
63+
<?php
64+
65+
require_once __DIR__ . '/lib/php-http-client/lib/Client.php';
66+
require_once __DIR__ . '/lib/php-http-client/lib/Response.php';
67+
require_once __DIR__ . '/lib/sendgrid-php/lib/SendGrid.php';
68+
69+
```
70+
71+
After it you can use `php-http-client` library in your project:
72+
73+
```php
74+
<?php
75+
76+
include __DIR__ . '/loader.php';
77+
78+
$client = new SendGrid\Client();
79+
```
80+
4181
# Quick Start
4282

4383
Here is a quick example:
4484

4585
`GET /your/api/{param}/call`
4686

4787
```php
88+
// include __DIR__ . '/loader.php';
4889
require 'vendor/autoload.php';
4990
$global_headers = array(Authorization: Basic XXXXXXX);
50-
$client = SendGrid\Client('base_url', global_headers);
91+
$client = new SendGrid\Client('base_url', global_headers);
5192
$response = $client->your()->api()->_($param)->call()->get();
5293
print $response->statusCode();
5394
print $response->headers();
@@ -57,9 +98,10 @@ print $response->body();
5798
`POST /your/api/{param}/call` with headers, query parameters and a request body with versioning.
5899

59100
```php
101+
// include __DIR__ . '/loader.php';
60102
require 'vendor/autoload.php';
61103
$global_headers = array(Authorization: Basic XXXXXXX);
62-
$client = SendGrid\Client('base_url', global_headers);
104+
$client = new SendGrid\Client('base_url', global_headers);
63105
$query_params = array('hello' => 0, 'world' => 1);
64106
$request_headers = array('X-Test' => 'test');
65107
$data = array('some' => 1, 'awesome' => 2, 'data' => 3);

0 commit comments

Comments
 (0)