PHPackages                             ramazancetinkaya/morse-code - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ramazancetinkaya/morse-code

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ramazancetinkaya/morse-code
===========================

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

1.0.0(2y ago)121141MITPHPPHP &gt;=8.0

Since Jan 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ramazancetinkaya/morse-code)[ Packagist](https://packagist.org/packages/ramazancetinkaya/morse-code)[ RSS](/packages/ramazancetinkaya-morse-code/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Morse Code Library
==================

[](#morse-code-library)

A modern PHP library for encoding and decoding Morse code with extended configuration options.

 [ ![Logo](logo.webp) ](https://github.com/ramazancetinkaya/morse-code)

 [Report a Bug](https://github.com/ramazancetinkaya/morse-code/issues) · [New Pull Request](https://github.com/ramazancetinkaya/morse-code/pulls)

Features
--------

[](#features)

- Encode and decode Morse code seamlessly.
- Customizable delimiters for letters and words.
- Multiple handling options for unknown characters.
- Configurable case preservation.
- Structured error handling with custom exceptions.
- Fully object-oriented and extensible.

Installation
------------

[](#installation)

This library can be easily installed using [Composer](https://getcomposer.org/), a modern PHP dependency manager.

### Step 1: Install Composer

[](#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

[](#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
```

*Alternatively, download the source code and include it in your project manually.*

### Requirements

[](#requirements)

- PHP 8.0 or higher.
- No additional dependencies.

Usage
-----

[](#usage)

```
require 'vendor/autoload.php'; // Include Composer's autoloader

use ramazancetinkaya\{MorseTranslator, MorseCodeConfig, UnknownCharHandling};

// Create a configuration where unknown characters are replaced with '?'
// and we separate letters with a single space, words with ' / ',
// and DO NOT preserve original case (defaults to uppercase).
$config = new MorseCodeConfig(
    unknownCharHandling: UnknownCharHandling::REPLACE,
    replacementChar: '?',
    preserveCase: false,
    letterDelimiter: ' ',  // single space between letters
    wordDelimiter: ' / '   // slash and spaces between words
);

// Create the translator
$translator = new MorseTranslator();

// Sample text to encode
$text = "Hello, World!";

try {
    // Encoding
    $encoded = $translator->encode($text, $config);
    echo "Original: {$text}\n";
    echo "Encoded:  {$encoded}\n";

    // Decoding
    $decoded = $translator->decode($encoded, $config);
    echo "Decoded:  {$decoded}\n";
} catch (MorseCodeException $exception) {
    // Handle or log the exception
    echo "Morse Code Error: " . $exception->getMessage() . "\n";
}
```

Configuration Options
---------------------

[](#configuration-options)

OptionDescription`unknownCharHandling`Defines how unknown characters are handled (`IGNORE`, `REPLACE`, `THROW_EXCEPTION`).`replacementChar`Specifies the character used when `REPLACE` mode is enabled.`preserveCase`If `true`, preserves original case; otherwise, converts text to uppercase.`letterDelimiter`Defines the separator between Morse code letters.`wordDelimiter`Defines the separator between Morse code words.License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bug fixes.

Author
------

[](#author)

Developed by [Ramazan Çetinkaya](https://github.com/ramazancetinkaya).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

855d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/04d76b5f72582c06350c3e59cc86fd79990444480ee01ab119e770ce34b4c9a1?d=identicon)[ramazancetinkaya](/maintainers/ramazancetinkaya)

---

Tags

morsemorse-codemorse-code-convertermorse-code-translatormorsecodemorsecode-encoder-decoderphpphp8

### Embed Badge

![Health badge](/badges/ramazancetinkaya-morse-code/health.svg)

```
[![Health](https://phpackages.com/badges/ramazancetinkaya-morse-code/health.svg)](https://phpackages.com/packages/ramazancetinkaya-morse-code)
```

###  Alternatives

[naffiq/telegram-channel-php

Post to your telegram channel with ease!

124.2k](/packages/naffiq-telegram-channel-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
