diff --git a/Dockerfile b/Dockerfile index 0a587e2..da1ef10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 7ff36bd..39a56e6 100644 --- a/README.md +++ b/README.md @@ -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`: @@ -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: diff --git a/USE_CASES.md b/USE_CASES.md new file mode 100644 index 0000000..5c161c6 --- /dev/null +++ b/USE_CASES.md @@ -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) + + +# 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. diff --git a/examples/example.php b/examples/example.php index 1de093e..107d95a 100644 --- a/examples/example.php +++ b/examples/example.php @@ -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'); diff --git a/test/unit/FilesExistTest.php b/test/unit/FilesExistTest.php index e15a46b..fbba1d9 100644 --- a/test/unit/FilesExistTest.php +++ b/test/unit/FilesExistTest.php @@ -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"); @@ -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); } }