#!/bin/bash # Script to install Twilio PHP SDK without Composer # This is REQUIRED for the plugin to work properly echo "Installing Twilio PHP SDK v8.7.0..." echo "IMPORTANT: This SDK is required for the plugin to function." # Check if we can download files if ! command -v curl &> /dev/null; then echo "ERROR: curl is required to download the SDK" echo "Please install curl and try again" exit 1 fi if ! command -v tar &> /dev/null; then echo "ERROR: tar is required to extract the SDK" echo "Please install tar and try again" exit 1 fi # Create vendor directory if it doesn't exist mkdir -p vendor/twilio/sdk # Download the latest release (8.7.0) echo "Downloading Twilio SDK from GitHub..." if ! curl -L https://github.com/twilio/twilio-php/archive/refs/tags/8.7.0.tar.gz -o twilio-sdk.tar.gz; then echo "ERROR: Failed to download Twilio SDK" echo "Please check your internet connection and try again" exit 1 fi # Extract the archive echo "Extracting SDK files..." if ! tar -xzf twilio-sdk.tar.gz; then echo "ERROR: Failed to extract SDK files" exit 1 fi # Check if the extracted directory exists if [ ! -d "twilio-php-8.7.0/src" ]; then echo "ERROR: Extracted SDK directory structure is unexpected" exit 1 fi # Create the Twilio directory structure echo "Setting up SDK directory structure..." mkdir -p vendor/twilio # Remove existing SDK if it exists if [ -d "vendor/twilio/sdk" ]; then rm -rf vendor/twilio/sdk fi # Move the entire src directory to be the sdk echo "Installing SDK files..." if ! mv twilio-php-8.7.0/src vendor/twilio/sdk; then echo "ERROR: Failed to move SDK files" exit 1 fi # Create a comprehensive autoloader cat > vendor/autoload.php << 'EOF'