Skip to content

Commit f2dd8b0

Browse files
Merge pull request sendgrid#84 from sendgrid/docker-update
Update Docker instructions
2 parents 73999d2 + f181ad5 commit f2dd8b0

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM php:7.1-apache
22

3+
ARG sendgrid_apikey
4+
ENV SENDGRID_API_KEY=$sendgrid_apikey
5+
36
COPY . /var/www/client
47
WORKDIR /var/www/client
58

README.md

-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ $ cd /path/to/your/app
6565
$ mkdir lib
6666
$ cd lib
6767
$ git clone https://github.com./sendgrid/php-http-client.git
68-
$ git clone https://github.com./sendgrid/sendgrid-php.git
6968
```
7069

7170
In the next step you should create `loader.php`:
@@ -82,8 +81,6 @@ And add to `loader.php` code below:
8281

8382
require_once __DIR__ . '/lib/php-http-client/lib/Client.php';
8483
require_once __DIR__ . '/lib/php-http-client/lib/Response.php';
85-
require_once __DIR__ . '/lib/sendgrid-php/lib/SendGrid.php';
86-
8784
```
8885

8986
After it you can use `php-http-client` library in your project:

USE_CASES.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
This documentation provides examples for specific use cases. Please [open an issue](https://github.com./sendgrid/php-http-client/issues) or make a pull request for any use cases you would like us to document here. Thank you!
2+
3+
# Table of Contents
4+
* [Docker](#docker)
5+
6+
<a name="docker"></a>
7+
# Docker
8+
9+
You can run the example code at `examples/example.php` in a Docker container.
10+
11+
From the root directory:
12+
13+
```bash
14+
cp examples/.env_sample .env
15+
```
16+
17+
Update the `.env` file with your SendGrid API Key. If you don't have one, you can get one [here](https://sendgrid.com/free?source=php-http-client).
18+
19+
Add the `.env` file to your `.gitignore` file if you are publishing your code publically.
20+
21+
```
22+
source .env
23+
docker build --build-arg sendgrid_apikey=$SENDGRID_API_KEY -t client .
24+
docker run client php examples/example.php
25+
```
26+
27+
You should see a list of your SendGrid API Keys.

examples/example.php

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// comment out the two includes below
55
// require __DIR__ . '/vendor/autoload.php';
66
include(dirname(__DIR__) . '/lib/Client.php');
7+
include(dirname(__DIR__) . '/lib/Response.php');
78
// This gets the parent directory, for your current directory use getcwd()
89
$path_to_config = dirname(__DIR__);
910
$apiKey = getenv('SENDGRID_API_KEY');

test/unit/FilesExistTest.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public function testFileArePresentInRepo()
1515
$this->assertFileExists("$rootDir/CHANGELOG.md");
1616
$this->assertFileExists("$rootDir/CODE_OF_CONDUCT.md");
1717
$this->assertFileExists("$rootDir/CONTRIBUTING.md");
18+
$this->assertFileExists("$rootDir/Dockerfile");
1819
$this->assertFileExists("$rootDir/.github/ISSUE_TEMPLATE");
1920
$this->assertFileExists("$rootDir/LICENSE.txt");
2021
$this->assertFileExists("$rootDir/.github/PULL_REQUEST_TEMPLATE");
@@ -25,9 +26,6 @@ public function testFileArePresentInRepo()
2526

2627
#$composeExists = file_exists('./docker-compose.yml') || file_exists('./docker/docker-compose.yml');
2728
#$this->assertTrue($composeExists);
28-
29-
#$dockerExists = file_exists('./Docker') || file_exists('./docker/Docker');
30-
#$this->assertTrue($dockerExists);
3129
}
3230
}
3331

0 commit comments

Comments
 (0)