Skip to content

DionPotkamp/twilio-sms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twilio SMS

This is a simple project that receives a webhook from a Twilio SMS and sends an email with the message.

Requirements

  • PHP 8.2
  • A Twilio account
  • A Twilio phone number

Setup

git clone [email protected]:DionPotkamp/twilio-sms.git
cd twilio-sms
composer install
cp .env.example .env

Twilio setup

  • Set the webhook URL to POST https://example.com/twilio.php in the Twilio console.

Configuration

  • Set the TWILIO_AUTH_TOKEN in the .env file.
  • Set the EMAIL_FROM and EMAIL_TO in the .env file.
  • Optionally set the SMTP server settings in the .env file.

Usage

  • Start the PHP built-in server with php -S localhost:8000 -t public to test locally.
  • Send an SMS to the Twilio phone number once deployed.

File structure

twilio-sms/
├── composer.json
├── composer.lock
├── .env
├── /vendor
├── /src
│   ├── Controller
│   │   └── TwilioController.php
│   ├── Service
│   │   ├── MailService.php
│   │   └── TwilioService.php
│   └── Utils
│       ├── Logger.php
│       └── TwilioRequestValidator.php
├── /public
│   ├── index.php
│   └── twilio.php
├── /config
│   └── config.php
├── /logs
│   └── app.log
└── /tests # todo ;P
    └── TwilioControllerTest.php

Deploy

composer install --no-ansi --no-dev --no-interaction --no-plugins --no-progress --no-scripts --optimize-autoloader

About

Receive Twilio messages and send them via email.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages