ramazancetinkaya/morse-code

A simple PHP library for converting text to Morse code and vice versa

1.0.0 2024-01-06 11:51 UTC

This package is auto-updated.

Last update: 2024-12-06 13:59:30 UTC


README

A simple PHP library for converting text to Morse code and vice versa

Installation

This library can be easily installed using Composer, a modern PHP dependency manager.

Step 1: Install Composer

If you don't have Composer installed, you can download and install it by following the instructions on the official Composer website.

Step 2: Install the Library

Once Composer is installed, you can install the morse-code library by running the following command in your project's root directory:

composer require ramazancetinkaya/morse-code

Usage

require_once 'vendor/autoload.php'; // Include Composer's autoloader

use ramazancetinkaya\MorseCode;
try {
    $text = "Hello World";
    $morse = MorseCode::textToMorse($text);
    echo "Text to Morse: " . $morse . "\n";

    $originalText = MorseCode::morseToText($morse);
    echo "Morse to Text: " . $originalText . "\n";
} catch (InvalidArgumentException $e) {
    echo "Error: " . $e->getMessage() . "\n";
}