turtle-wow-source-kinda/Dumps/Source Code/9 - Development_website_old/master/api/sendgrid-php/docker
Brian Oost a1d5bb70b2 Init
2024-08-06 18:06:40 +02:00
..
Dockerfile Init 2024-08-06 18:06:40 +02:00
entrypoint.sh Init 2024-08-06 18:06:40 +02:00
README.md Init 2024-08-06 18:06:40 +02:00
USAGE.md Init 2024-08-06 18:06:40 +02:00

Use Docker to easily try out or contribute to the sendgrid-php library.

This Docker image contains:

  • PHP 7.1.16
  • A running instance of Stoplight.io's Prism, which lets you try out the SendGrid API without actually sending email
  • A mirrored copy of sendgrid-php so that you may develop locally and then run the tests within the Docker container.

Table of Contents

Quick Start

  1. Install Composer:
  • php -r "readfile('https://getcomposer.org/installer');" | php
  • mv composer.phar /usr/local/bin/composer
  1. Clone the sendgrid-php repo
  • git clone https://github.com/sendgrid/sendgrid-php.git
  • cd sendgrid-php
  • composer install
  1. Install Docker
  2. Setup local environment variable SENDGRID_API_KEY
  3. Build Docker image, run Docker container, login to the Docker container
  • docker image build --tag="sendgrid/php7" ./docker
  • docker run -itd --name="sendgrid_php7" -v $(pwd):/root/sendgrid-php sendgrid/php7 /bin/bash
  1. Run the tests within the Docker container
  • sudo docker exec -it sendgrid_php7 /bin/bash -c 'cd sendgrid-php/test; ../vendor/bin/phpunit . --filter test*; exec "${SHELL:-sh}"'

Now you can continue development locally, and run ../vendor/bin/phpunit . --filter test* inside of the container to test. Replace test* with the name of a particular test if you do not wish to run the entire suite of tests.

To clean up the container: docker stop sendgrid_php7 && docker rm sendgrid_php7.

Happy Hacking!

For Testing the Library (Kick the Tires)

  • After step 5 in the QuickStart, within the Docker container:
    • cd ../
    • php sendmail.php

For Contributors

  • Develop per usual locally, but before pushing up to GitHub, you can run the tests locally in the Docker container per step 5 of the quickstart.
  • To run all the tests: ../vendor/bin/phpunit . --filter test*
  • To run an individual test: ../vendor/bin/phpunit . --filter [Name of Test]