PHPackages                             tuupola/trytes - 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. tuupola/trytes

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

tuupola/trytes
==============

Trytes encoder and decoder for arbitrary data

0.1.0(8y ago)485MITPHPPHP ^5.6 || ^7.0

Since Dec 10Pushed 8y ago1 watchersCompare

[ Source](https://github.com/tuupola/trytes)[ Packagist](https://packagist.org/packages/tuupola/trytes)[ Docs](https://github.com/tuupola/trytes)[ RSS](/packages/tuupola-trytes/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (2)Used By (0)

Trytes
======

[](#trytes)

This library implements Trytes encoding as described by [IOTA](https://learn.iota.org/faq/trytes-and-trits) project. Trytes are equivalent of bytes but in [ternary](http://homepage.divms.uiowa.edu/~jones/ternary/numbers.shtml) number system.

[![Latest Version](https://camo.githubusercontent.com/bfaffd8ebb04ec375e5a8d87ad5bed266fa95d01b5938a353df7ad7e34a0d536/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f747575706f6c612f7472797465732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tuupola/trytes)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/c66fb0ed5125a437b318d1fa358fd2f312eae6ce6a9e57429065cd6f335f6aac/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f747575706f6c612f7472797465732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tuupola/trytes)[![Coverage](https://camo.githubusercontent.com/d3c1dbaa285246fc13890f00c4326f4a91af5abb30b5a74f82447172962e89ea/687474703a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f747575706f6c612f7472797465732e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/tuupola/trytes)

Install
-------

[](#install)

Install with [composer](https://getcomposer.org/).

```
$ composer require tuupola/trytes
```

Usage
-----

[](#usage)

```
$trytes = new Tuupola\Trytes;

$encoded = $trytes->encode(random_bytes(128));
$decoded = $trytes->decode($encoded);
```

Character sets
--------------

[](#character-sets)

By default this library uses the [IOTA](http://iota.org/) style character set. Shortcut is provided also for [Heptavintimal](http://homepage.divms.uiowa.edu/~jones/ternary/hept.shtml) characters. If required you can use any custom character set of 27 unique characters.

```
use Tuupola\Trytes;

print Trytes::IOTA; /* 9ABCDEFGHIJKLMNOPQRSTUVWXYZ */
print Trytes::HEPTAVINTIMAL; /* 0123456789ABCDEFGHKMNPRTVXZ */

$default = new Trytes(["characters" => Trytes::IOTA]);
$heptavintimal = new Trytes(["characters" => Trytes::HEPTAVINTIMAL]);
print $default->encode("Hello world!"); /* RBTC9D9DCDEAKDCDFD9DSCFA */
print $heptavintimal->encode("Hello world!"); /* K2N304043451B4346404M361 */
```

Static Proxy
------------

[](#static-proxy)

If you prefer to use static syntax use the provided static proxy.

```
use Tuupola\TrytesProxy as Trytes;

$encoded = Trytes::encode(random_bytes(128));
$decoded = Trytes::decode($encoded);
```

Testing
-------

[](#testing)

You can run tests either manually or automatically on every code change. Automatic tests require [entr](http://entrproject.org/) to work.

```
$ make test
```

```
$ brew install entr
$ make watch
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

3074d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3325405a7d8a43bc40dd0e760a4b7f268fba32a7150cf0327f64f13d1661df0b?d=identicon)[tuupola](/maintainers/tuupola)

---

Top Contributors

[![tuupola](https://avatars.githubusercontent.com/u/21913?v=4)](https://github.com/tuupola "tuupola (11 commits)")

---

Tags

iotaiotatrytes

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/tuupola-trytes/health.svg)

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

###  Alternatives

[mgallegos/laravel-jqgrid

Laravel jqGrid package allows you to easily integrate the popular jQuery Grid Plugin (jqGrid) into your Laravel application.

7115.5k1](/packages/mgallegos-laravel-jqgrid)[lifeonscreen/nova-sort-relations

This package improves support for sorting relations in Laravel Nova.

2081.9k](/packages/lifeonscreen-nova-sort-relations)

PHPackages © 2026

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