From 4baf78c6246096087020627473bbecbdc7e38b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramazan=20=C3=87etinkaya?= Date: Sat, 6 Jan 2024 14:51:31 +0300 Subject: [PATCH] Update README.md --- README.md | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cf688f5..00a0745 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,40 @@ -# morse-code +# Morse Code + A simple PHP library for converting text to Morse code and vice versa + +## Installation + +This library can be easily installed using [Composer](https://getcomposer.org/), 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](https://getcomposer.org/download/). + +### 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: + +```bash +composer require ramazancetinkaya/morse-code +``` + +## Usage + +```php +require_once 'vendor/autoload.php'; // Include Composer's autoloader + +use ramazancetinkaya\MorseCode; +``` + +```php +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"; +} +```