mirror of
https://github.com/brian8544/turtle-wow.git
synced 2025-01-01 04:14:35 +00:00
.. | ||
Dockerfile | ||
entrypoint.sh | ||
README.md | ||
USAGE.md |
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
- Install Composer:
php -r "readfile('https://getcomposer.org/installer');" | php
mv composer.phar /usr/local/bin/composer
- Clone the sendgrid-php repo
git clone https://github.com/sendgrid/sendgrid-php.git
cd sendgrid-php
composer install
- Install Docker
- Setup local environment variable SENDGRID_API_KEY
- 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
- 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]