PHPackages                             jocic/encoders - 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. [Security](/categories/security)
4. /
5. jocic/encoders

ActiveLibrary[Security](/categories/security)

jocic/encoders
==============

Encoders is a creatively named PHP library containing various binary-to-text encoding implementations.

1.0.0(7y ago)21.2kMITPHPPHP &gt;=7.0

Since Jan 4Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jocic/PHP.Encoders)[ Packagist](https://packagist.org/packages/jocic/encoders)[ RSS](/packages/jocic-encoders/feed)WikiDiscussions master Synced 1mo ago

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

Encoders
========

[](#encoders)

[![Build Status](https://camo.githubusercontent.com/ba7f1a6d71ec03c6ca3b876101c3844eeec08de9359690ed493d6efa32df84cc/68747470733a2f2f7472617669732d63692e6f72672f6a6f6369632f5048502e456e636f646572732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jocic/PHP.Encoders) [![Coverage Status](https://camo.githubusercontent.com/2c040189e5900f3a77b38ebb697ef51a727dc9d54d3b34533951a308f32d2fab/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6a6f6369632f5048502e456e636f646572732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/jocic/PHP.Encoders?branch=master) [![Codacy Badge](https://camo.githubusercontent.com/1fecc1924bb7f8a062291cbd25a73eccf9f825eacf4ee0847bc804c53e856d71/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3464303736623834336262363436306361353663353432386231653864313464)](https://www.codacy.com/app/jocic/PHP.Encoders?utm_source=github.com&utm_medium=referral&utm_content=jocic/PHP.Encoders&utm_campaign=Badge_Grade) [![Latest Stable Version](https://camo.githubusercontent.com/6f96a4d1ac25e824ab77dc353947756b8c16d466111598284b0cf3756f5a819e/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6369632f656e636f646572732f762f737461626c65)](https://packagist.org/packages/jocic/encoders) [![License](https://camo.githubusercontent.com/f60915773f605b3fe09aade59f5dfe8ccab889d7edfb06b2391061818caa0f56/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6369632f656e636f646572732f6c6963656e7365)](https://packagist.org/packages/jocic/encoders)

Encoders is a creatively named PHP library containing various binary-to-text encoding implementations.

I basically wrote a Base 32 implementation for my other project, Google Authenticator which you can find on GitHub, and thought to myself, hey...why not create an entire library featuring binary-to-text encoders, that's kind of fun? So here it is. A filler project, for fun.

[![Project Image](images/project-image-small.png)](images/project-image-small.png)

Following specifications are referenced:

- [RFC 4648](other/specifications/rfc4648.txt) - Base 16, Base 32 &amp; Base 64 Data Encodings

[![Buy Me Coffee](images/buy-me-coffee.png)](https://www.paypal.me/DjordjeJocic)

**Song of the project:** [Albert Veli - Write in C](https://www.youtube.com/watch?v=1S1fISh-pag)

Versioning Scheme
-----------------

[](#versioning-scheme)

I use a 3-digit [Semantic Versioning](https://semver.org/spec/v2.0.0.html) identifier, for example 1.0.2. These digits have the following meaning:

- The first digit (1) specifies the MAJOR version number.
- The second digit (0) specifies the MINOR version number.
- The third digit (2) specifies the PATCH version number.

Complete documentation can be found by following the link above.

Examples
--------

[](#examples)

Using encoders from the library is extremely simple but, just in case you are getting started with PHP programming language, I've prepared several examples to help you on your journey. You simply need to instantiate an object of your desired encoder and use the "encode" or "decode" methods respectively.

### Base Encoding &amp; Decoding

[](#base-encoding--decoding)

Only Base 16 and Base 32 are currently supported.

#### Base 16

[](#base-16)

```
$encoder = new Jocic\Encoders\Base\Base16();

echo $encoder->encode("foo");
echo $encoder->decode("666F6F");
```

#### Base 32

[](#base-32)

```
$encoder = new Jocic\Encoders\Base\Base32();

echo $encoder->encode("foo");
echo $encoder->decode("MZXW6===");
```

#### Base 64

[](#base-64)

```
$encoder = new Jocic\Encoders\Base\Base64();

echo $encoder->encode("foo");
echo $encoder->decode("Zm9v");
```

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

[](#installation)

There's two ways you can add **Encoders** library to your project:

- Copying files from the "source" directory to your project and requiring the "Autoload.php" script
- Via Composer, by executing the command below

```
composer require jocic/encoders 1.0.0
```

Tests
-----

[](#tests)

Following unit tests are available:

- **Essentials** - Tests for library's essentials ex. Autoloader, etc.
- **Base** - Tests for Base encoders - Base 16, Base 32 &amp; Base 64.

You can execute them easily from the terminal like in the example below.

```
bash ./scripts/phpunit.sh --testsuite essentials
bash ./scripts/phpunit.sh --testsuite base
```

Please don’t forget to install necessary dependencies before attempting to do the God's work above. They may be important.

```
bash ./scripts/composer.sh install
```

Contribution
------------

[](#contribution)

Please review the following documents if you are planning to contribute to the project:

- [Contributor Covenant Code of Conduct](code-of-conduct.md)
- [Contribution Guidelines](contributing.md)
- [Pull Request Template](pull-request-template.md)
- [MIT License](license.md)

Support
-------

[](#support)

Please don't hesitate to contact me if you have any questions, ideas, or concerns.

My Twitter account is: [@jocic\_91](https://www.twitter.com/jocic_91)

My support E-Mail address is:

Copyright &amp; License
-----------------------

[](#copyright--license)

Copyright (C) 2018 Đorđe Jocić

Licensed under the MIT license.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2678d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b022fe84b009f3dcc944f03764d393cbda99123867e1bc7fefa6b1d93919b1d?d=identicon)[jocic](/maintainers/jocic)

---

Top Contributors

[![jocic](https://avatars.githubusercontent.com/u/10118993?v=4)](https://github.com/jocic "jocic (35 commits)")

---

Tags

base-16base-32base-64encoderslibraryphpsecurityencoders

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jocic-encoders/health.svg)

```
[![Health](https://phpackages.com/badges/jocic-encoders/health.svg)](https://phpackages.com/packages/jocic-encoders)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41478.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

87117.5M63](/packages/bjeavons-zxcvbn-php)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)[paragonie/hidden-string

Encapsulate strings in an object to hide them from stack traces

7410.6M39](/packages/paragonie-hidden-string)

PHPackages © 2026

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