Skip to content

Update Docker instructions #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM php:7.1-apache

ARG sendgrid_apikey
ENV SENDGRID_API_KEY=$sendgrid_apikey

COPY . /var/www/client
WORKDIR /var/www/client

Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ $ cd /path/to/your/app
$ mkdir lib
$ cd lib
$ git clone https://github.com/sendgrid/php-http-client.git
$ git clone https://github.com/sendgrid/sendgrid-php.git
```

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

require_once __DIR__ . '/lib/php-http-client/lib/Client.php';
require_once __DIR__ . '/lib/php-http-client/lib/Response.php';
require_once __DIR__ . '/lib/sendgrid-php/lib/SendGrid.php';

```

After it you can use `php-http-client` library in your project:
Expand Down
27 changes: 27 additions & 0 deletions USE_CASES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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!

# Table of Contents
* [Docker](#docker)

<a name="docker"></a>
# Docker

You can run the example code at `examples/example.php` in a Docker container.

From the root directory:

```bash
cp examples/.env_sample .env
```

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).

Add the `.env` file to your `.gitignore` file if you are publishing your code publically.

```
source .env
docker build --build-arg sendgrid_apikey=$SENDGRID_API_KEY -t client .
docker run client php examples/example.php
```

You should see a list of your SendGrid API Keys.
1 change: 1 addition & 0 deletions examples/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// comment out the two includes below
// require __DIR__ . '/vendor/autoload.php';
include(dirname(__DIR__) . '/lib/Client.php');
include(dirname(__DIR__) . '/lib/Response.php');
// This gets the parent directory, for your current directory use getcwd()
$path_to_config = dirname(__DIR__);
$apiKey = getenv('SENDGRID_API_KEY');
Expand Down
4 changes: 1 addition & 3 deletions test/unit/FilesExistTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function testFileArePresentInRepo()
$this->assertFileExists("$rootDir/CHANGELOG.md");
$this->assertFileExists("$rootDir/CODE_OF_CONDUCT.md");
$this->assertFileExists("$rootDir/CONTRIBUTING.md");
$this->assertFileExists("$rootDir/Dockerfile");
$this->assertFileExists("$rootDir/.github/ISSUE_TEMPLATE");
$this->assertFileExists("$rootDir/LICENSE.txt");
$this->assertFileExists("$rootDir/.github/PULL_REQUEST_TEMPLATE");
Expand All @@ -25,9 +26,6 @@ public function testFileArePresentInRepo()

#$composeExists = file_exists('./docker-compose.yml') || file_exists('./docker/docker-compose.yml');
#$this->assertTrue($composeExists);

#$dockerExists = file_exists('./Docker') || file_exists('./docker/Docker');
#$this->assertTrue($dockerExists);
}
}