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:
- A real-world smoke test for the Parcel Wing PHP SDK.
- A starter example for developers who want to send their first email from PHP.
- PHP built-in web server
- Official
parcelwing/parcelwing-phpSDK - A single local browser form for entering an API key, sender, recipient, subject, and message body
- Optional
PARCELWING_API_KEYandPARCELWING_BASE_URLenvironment variables for repeat testing - No framework and no database
- 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
composer install
composer startThen open:
http://localhost:8000
Paste your Parcel Wing API key, fill in the sender and recipient fields, and send a test email.
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.comThe 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.
.
├── public
│ ├── index.php
│ └── styles.css
├── .env.example
├── .gitignore
├── composer.json
├── LICENSE
└── README.md
- The form posts to the same local PHP page.
- The server creates a
ParcelWing\ParcelWingclient 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.