Skip to content

parcelwing/parcelwing-php-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parcel Wing PHP Example App

A tiny PHP web app that demonstrates sending a test email with the official parcelwing/parcelwing-php SDK.

It is intentionally small enough to use as both:

  1. A real-world smoke test for the Parcel Wing PHP SDK.
  2. A starter example for developers who want to send their first email from PHP.

What it includes

  • PHP built-in web server
  • Official parcelwing/parcelwing-php SDK
  • A single local browser form for entering an API key, sender, recipient, subject, and message body
  • Optional PARCELWING_API_KEY and PARCELWING_BASE_URL environment variables for repeat testing
  • No framework and no database

Requirements

  • PHP 8.1 or newer
  • Composer
  • PHP cURL extension
  • A Parcel Wing API key. Don't have one? Get one for free at parcelwing.com/signup
  • A verified sending domain in Parcel Wing

Quick start

composer install
composer start

Then open:

http://localhost:8000

Paste your Parcel Wing API key, fill in the sender and recipient fields, and send a test email.

Environment variables

You can create a .env file or export these in your shell:

PARCELWING_API_KEY=pw_live_your_api_key_here
PARCELWING_BASE_URL=https://parcelwing.com

The app still lets you override the API key and base URL from the UI. API keys are only used by the local PHP request and are not stored by the app.

Project structure

.
├── public
│   ├── index.php
│   └── styles.css
├── .env.example
├── .gitignore
├── composer.json
├── LICENSE
└── README.md

Notes

  • The form posts to the same local PHP page.
  • The server creates a ParcelWing\ParcelWing client and calls $parcelwing->emails->send(...).
  • Multiple recipients can be entered as a comma-separated list.
  • Keep this app local. It is intentionally designed as a testing/demo tool, not as a production email form.

About

PHP example app for sending test emails with the official Parcel Wing SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors