juancamacho/php-sms

PHP library for interacting with SMS functionality using Gammu

dev-main 2023-07-13 13:25 UTC

This package is auto-updated.

Last update: 2024-10-09 09:48:11 UTC


README

This is a PHP library for interacting with SMS functionality using Gammu.

Table of Contents

Installation

Requirements

  • Runs on PHP 5.6 or above
  • Recomended PHP 7 or above
  • Gammu installed and configured
  1. Clone the repository:

    git clone https://github.com/your-username/sms-library.git
  2. Install the library dependencies using Composer:

    composer install

Usage

Initialize the SMS object

use SMS\SMS;

$sms = new SMS('/path/to/gammu', '/path/to/config', 'section_name');

Send an SMS

$number = '+1234567890';
$message = 'Hello, World!';

$response = '';
$sms->send($number, $message, $response);

if ($response) {
    echo "SMS sent successfully!\n";
} else {
    echo "Failed to send SMS.\n";
}

Delete an SMS

$folder = 'inbox';
$start = 1;
$stop = 10;

$response = '';
$sms->delete($folder, $start, $stop, $response);

if ($response) {
    echo "SMS deleted successfully!\n";
} else {
    echo "Failed to delete SMS.\n";
}

Get SMS Messages

$messages = $sms->getMessages();

// Process and display the messages
foreach ($messages as $folder => $messageList) {
    foreach ($messageList as $messageId => $message) {
        // Process individual message data
    }
}

Get Phonebook Contacts

$contacts = $sms->getPhoneBook();

// Process and display the contacts
foreach ($contacts as $index => $contact) {
    // Process individual contact data
}

Features

  • Send SMS messages
  • Delete SMS messages
  • Retrieve SMS messages
  • Access phonebook contacts

Contributing

Contributions are welcome! Here's how you can contribute:

  1. Fork the repository.
  2. Create a new branch.
  3. Make your changes.
  4. Test your changes.
  5. Submit a pull request.