PHPackages                             biohzrdmx/tokenizr-php - 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. biohzrdmx/tokenizr-php

ActiveLibrary[Security](/categories/security)

biohzrdmx/tokenizr-php
======================

Salted, SHA256-hashed token generation and checking

3.0(5y ago)07MITPHPPHP &gt;=5.6

Since Mar 31Pushed 5y ago1 watchersCompare

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

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

tokenizr-php
============

[](#tokenizr-php)

Salted, SHA256-hashed token generation and checking

Requirements
------------

[](#requirements)

- PHP 5.2+

Basic usage
-----------

[](#basic-usage)

First require `biohzrdmx/tokenizr-php` with Composer.

Use `create` to tokenize your data. It will return an string with the source data and its message digest:

```
# Import namespace
use Tokenizr\Tokenizr;

$tokenizr = new Tokenizr($salt);
$token = $tokenizr->create('something');
```

You can then save the token wherever you want. To check it back, use `check`

```
$valid = $tokenizr->check('something.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
```

To get back the data, use `getData`

```
$data = $tokenizr->getData('something.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
```

Note that the data and its message digest are separated by a PERIOD, so it wouldn't be a good idea to try to tokenize strings containing periods unless you change the divider (via the 2nd parameter in the constructor).

You may also pass an `array` as the token payload and it will be converted to a query string for proper use.

Also note that the data is saved in plain sight, THIS CLASS IS NOT DESIGNED TO ENCRYPT DATA. The purpose of this class is to provide a way to check if the data (from a cookie, for example) has been generated by your code and not forged. The checksum is reliable as long as you NEVER DISCLOSE YOUR SALTS.

Licensing
---------

[](#licensing)

The MIT License (MIT)

Copyright (c) 2021 biohzrdmx

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

### Credits

[](#credits)

**Lead coder:** biohzrdmx [github.com/biohzrdmx](http://github.com/biohzrdmx)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

1867d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/44b968bb45d47a621ce8e81c422ef4c126316a702156a7faf96df75610cc0d45?d=identicon)[biohzrdmx](/maintainers/biohzrdmx)

---

Top Contributors

[![biohzrdmx](https://avatars.githubusercontent.com/u/2053303?v=4)](https://github.com/biohzrdmx "biohzrdmx (9 commits)")

---

Tags

hashphpsha256token

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/biohzrdmx-tokenizr-php/health.svg)

```
[![Health](https://phpackages.com/badges/biohzrdmx-tokenizr-php/health.svg)](https://phpackages.com/packages/biohzrdmx-tokenizr-php)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[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

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

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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