PHPackages                             ksfraser/validation - 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. ksfraser/validation

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

ksfraser/validation
===================

Small validation helpers and traits (PHP 7.3+) for KS Fraser modules migration.

v0.1.0(3mo ago)02MITPHPPHP &gt;=7.3

Since Feb 9Pushed 3mo agoCompare

[ Source](https://github.com/ksfraser/Validation)[ Packagist](https://packagist.org/packages/ksfraser/validation)[ RSS](/packages/ksfraser-validation/feed)WikiDiscussions main Synced 1mo ago

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

ksfraser/validation
===================

[](#ksfraservalidation)

PHP 7.3+ validation helpers and traits intended to replace legacy `Origin`-style ad-hoc validation during the library split.

Design goals
------------

[](#design-goals)

- No framework dependencies.
- Usable from DTOs, repositories, service classes.
- Prefer composition/traits over deep inheritance.
- Throw a consistent exception type (`ValidationException`).

Usage
-----

[](#usage)

### Static helper

[](#static-helper)

```
use Ksfraser\Validation\Assert;

Assert::notEmptyString($bankAccountNumber, 'bankAccountNumber');
Assert::stringMaxLen($bankAccountNumber, 255, 'bankAccountNumber');
```

### Trait (thin wrapper over `Assert`)

[](#trait-thin-wrapper-over-assert)

```
use Ksfraser\Validation\Traits\ValidatesStringTrait;

final class Example
{
    use ValidatesStringTrait;

    public function setCode($code)
    {
        $this->assertNotEmptyString($code, 'code');
        $this->assertStringMaxLen($code, 20, 'code');
    }
}
```

Relationship to the split
-------------------------

[](#relationship-to-the-split)

This package was introduced as part of the long-running split of a legacy “ksf\_modules\_common” folder into multiple Composer packages.

If you are working inside that monorepo/workspace, see the local docs there:

- `LIBRARY_SPLIT_ANALYSIS.md`
- `repos/fa_classes/MIGRATION_NOTES.md`
- `repos/ksf_ModulesDAO/README.md`

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance81

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity19

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

98d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c8870cc04b29a973eed9ad367a936ab274d744de37ff0c35fa0540a932905271?d=identicon)[ksfraser](/maintainers/ksfraser)

---

Top Contributors

[![ksfraser](https://avatars.githubusercontent.com/u/54461925?v=4)](https://github.com/ksfraser "ksfraser (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ksfraser-validation/health.svg)

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

###  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)
