PHPackages                             yohns/hash - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. yohns/hash

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

yohns/hash
==========

A simple hashing technique for forms

0.5.0(1y ago)03MITPHP

Since Nov 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Yohn/Hash)[ Packagist](https://packagist.org/packages/yohns/hash)[ RSS](/packages/yohns-hash/feed)WikiDiscussions main Synced 1mo ago

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

Hash Library
============

[](#hash-library)

A secure and efficient PHP library for generating, validating, and managing tokens.

---

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

[](#installation)

Install the package via Composer:

```
composer require yohns/hash
```

---

Usage
-----

[](#usage)

### 1. Generating a Token

[](#1-generating-a-token)

Use the `generateToken` method to create a secure token.

```
use Yohns\Security\Finding\Hash;

$token = Hash::generateToken('form-id'); // This value will be used again to validate the token
// add token to form
echo '';
```

---

### 2. Validating a Token

[](#2-validating-a-token)

Verify the validity of a token with the `validateToken` method.

```
use Yohns\Security\Finding\Hash;

$isValid = Hash::validateToken('form-id', $_POST['YohnsPatch']);
if ($isValid) {
	echo 'Token is valid!';
} else {
	echo 'Token is invalid or expired.';
}
```

---

### 3. Garbage Collection

[](#3-garbage-collection)

Remove expired tokens to maintain optimal performance.

```
use Yohns\Security\Finding\Hash;

Hash::garbageCollect();
echo 'Expired tokens removed.';
```

---

Running Tests
-------------

[](#running-tests)

Ensure everything works as expected by running the test suite:

```
composer test
```

---

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

[](#requirements)

- PHP 8.1 or later, 8.3 preferred
- Composer
- [Yohns\\Core\\Config](https://github.com/Yohn/Config)

---

License
-------

[](#license)

This library is licensed under [MIT License](LICENSE).

---

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

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 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

542d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c53f441885ec90d8d6e547f4c9023da12f10229c3848059e19b6aba9be1859a?d=identicon)[Yohn](/maintainers/Yohn)

---

Top Contributors

[![Yohn](https://avatars.githubusercontent.com/u/2002591?v=4)](https://github.com/Yohn "Yohn (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yohns-hash/health.svg)

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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