PHPackages                             kurdt94/yii2-isbn-validator - 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. kurdt94/yii2-isbn-validator

ActiveYii2-extension[Validation &amp; Sanitization](/categories/validation)

kurdt94/yii2-isbn-validator
===========================

ISBN form validation for ISBN-10 and ISBN-13 identifiers

037PHP

Since Aug 28Pushed 2y ago1 watchersCompare

[ Source](https://github.com/kurdt94/yii2-isbn-validator)[ Packagist](https://packagist.org/packages/kurdt94/yii2-isbn-validator)[ RSS](/packages/kurdt94-yii2-isbn-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-isbn-validator
===================

[](#yii2-isbn-validator)

This extension adds ISBN-10 / ISBN-13 Form validation as a standalone validator to the Yii2 framework.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ php composer.phar require kurdt94/yii2-isbn-validator "@dev"

```

or add

```
"kurdt94/yii2-isbn-validator": "@dev"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

This extension extends the `yii\validators\Validator` class to validate ISBN-10 or ISBN-13 identifiers. The `IsbnValidator` class can be applied using the alias `k-isbn` in your model rules. In this example we validate the "isbn\_number" field:

```
use yii\db\ActiveRecord;

class BooksModel extends ActiveRecord {
    /**
     * @return array the validation rules.
     */
    public function rules()
    {
        return [
            //...
            [['isbn_number'], 'k-isbn'],
        ];
    }
}
```

Ajax Validation
---------------

[](#ajax-validation)

Prefered is the use of AjaxValidation. This can be aplied using the ActiveForm `enableAjaxValidation` property.

```
echo $form->field($model, 'isbn_number', ['enableAjaxValidation' => true]);
```

\-- Or if you wish to enable AjaxValidation on the entire Form. --

```
echo $form = ActiveForm::begin(['id' => 'books-form', 'enableAjaxValidation' => true,]);
```

Don't forget to set up Ajax response in your controller-action. If the request `isAjax` and we can `load($_POST)` then return `\yii\widgets\ActiveForm::validate($model)`.

```
$model = new Books();

if (Yii::$app->request->isAjax && $model->load($_POST))
{
    Yii::$app->response->format = 'json';
    return \yii\widgets\ActiveForm::validate($model);
}
```

License
-------

[](#license)

This extension is released under the **BSD-3-Clause License**. Please read `LICENSE.md` for more details.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity21

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e04d1e0f5860fecaaec3dc4b9b2717e2936e743dc3e60b63a579752349bbb0e?d=identicon)[kurdt94](/maintainers/kurdt94)

---

Top Contributors

[![kurdt94](https://avatars.githubusercontent.com/u/2235069?v=4)](https://github.com/kurdt94 "kurdt94 (27 commits)")

### Embed Badge

![Health badge](/badges/kurdt94-yii2-isbn-validator/health.svg)

```
[![Health](https://phpackages.com/badges/kurdt94-yii2-isbn-validator/health.svg)](https://phpackages.com/packages/kurdt94-yii2-isbn-validator)
```

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