PHPackages                             kkiernan/caesar-cipher - 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. kkiernan/caesar-cipher

ActiveLibrary

kkiernan/caesar-cipher
======================

Encrypt, decrypt and crack messages using the simple Caesar Cipher algorithm.

v1.3(9y ago)1318.0k↓50%5[2 issues](https://github.com/kkiernan/caesar-cipher-php/issues)MITPHP

Since Apr 19Pushed 9y ago1 watchersCompare

[ Source](https://github.com/kkiernan/caesar-cipher-php)[ Packagist](https://packagist.org/packages/kkiernan/caesar-cipher)[ RSS](/packages/kkiernan-caesar-cipher/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

Caesar Cipher
=============

[](#caesar-cipher)

A basic Caesar Cipher class in PHP for fun and learning.

[![Build Status](https://camo.githubusercontent.com/58f987be934757b192084a069adfce932ec4692f778143aad2ce0859197a5a9a/68747470733a2f2f7472617669732d63692e6f72672f6b6b6965726e616e2f6361657361722d6369706865722d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kkiernan/caesar-cipher-php)[![Style Status](https://camo.githubusercontent.com/3b712d20f8d5c6f18c8483b33111b0945cfd4dab67345c4dba9cbb59f71e8d7b/68747470733a2f2f7374796c6563692e696f2f7265706f732f35303435353731302f736869656c64)](https://styleci.io/repos/50455710)

- [Installation](#installation)
- [Instantiation](#instantiation)
- [Available Methods](#available-methods)
    - [Encrypt](#encrypt)
    - [Decrypt](#decrypt)
    - [Crack](#crack)
- [Security](#security)

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

[](#installation)

Install the package using Composer.

```
composer require kkiernan/caesar-cipher

```

Instantiation
-------------

[](#instantiation)

Create a new `CaesarCipher` instance. Make sure to import the class or use the fully qualified class name.

```
$cipher = new KKiernan\CaesarCipher();
```

Available Methods
-----------------

[](#available-methods)

### Encrypt

[](#encrypt)

To encrypt a message, pass the `CaesarCipher` instance some plaintext and a key. In a Caesar Cipher, the key is just the number of places to shift each letter in the plaintext.

```
$ciphertext = $cipher->encrypt('This is a plain text message that will be encrypted!', 8);
```

### Decrypt

[](#decrypt)

To decrypt a ciphertext, use the `decrypt` method on the `CaesarCipher` instance. Pass in the ciphertext and the key that was used to encrypt the message.

```
$plaintext = $cipher->decrypt($ciphertext, 8);
```

### Crack

[](#crack)

You can attempt to crack an encrypted message by using the `crack` method, which will return a best guess for the key's value. Use the key to retrieve the plaintext.

```
$key = $cipher->crack('Max wtrl tkx zxmmbgz lahkm tztbg.');

$plaintext = $this->decrypt($ciphertext, $key);
```

Security
--------

[](#security)

This was written for fun and learning very basic encryption techniques (like substitution in this case). Obviously Caesar Cipher is not a secure encryption algorithm (only 25 possible keys), so don't use this for anything sensitive. It's really a toy meant for fun.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 92.9% of commits — single point of failure

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

Every ~127 days

Total

4

Last Release

3300d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/99d8fa03037957d5ebd061dade4a624bc2b7b324cef2c955f5a8dcb728d97ab1?d=identicon)[kkiernan](/maintainers/kkiernan)

---

Top Contributors

[![kkiernan](https://avatars.githubusercontent.com/u/3057556?v=4)](https://github.com/kkiernan "kkiernan (26 commits)")[![dansita](https://avatars.githubusercontent.com/u/16650719?v=4)](https://github.com/dansita "dansita (1 commits)")[![inkeliz](https://avatars.githubusercontent.com/u/4644332?v=4)](https://github.com/inkeliz "inkeliz (1 commits)")

### Embed Badge

![Health badge](/badges/kkiernan-caesar-cipher/health.svg)

```
[![Health](https://phpackages.com/badges/kkiernan-caesar-cipher/health.svg)](https://phpackages.com/packages/kkiernan-caesar-cipher)
```

PHPackages © 2026

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