A simple PHP library for converting text to Morse code and vice versa
This library can be easily installed using Composer, a modern PHP dependency manager.
If you don't have Composer installed, you can download and install it by following the instructions on the official Composer website.
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
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";
}