PHPackages                             jacobfitzp/laravel-tiptap-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. jacobfitzp/laravel-tiptap-validation

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

jacobfitzp/laravel-tiptap-validation
====================================

Laravel validation rules for the Tiptap WYSIWYG editor.

1.1.3(2y ago)202.4k[2 PRs](https://github.com/JacobFitzp/laravel-tiptap-validation/pulls)MITPHPPHP ^8.1

Since May 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/JacobFitzp/laravel-tiptap-validation)[ Packagist](https://packagist.org/packages/jacobfitzp/laravel-tiptap-validation)[ Docs](https://github.com/jacobfitzp/laravel-tiptap-validation)[ RSS](/packages/jacobfitzp-laravel-tiptap-validation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (14)Versions (9)Used By (0)

Laravel Tiptap validation
=========================

[](#laravel-tiptap-validation)

[![](https://camo.githubusercontent.com/5fdbe1db596451ef00b81d2351f2f21925e29fc4e611b01e2c6a17b290ea9322/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c25323054697074617025323076616c69646174696f6e2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6a61636f626669747a702532466c61726176656c2d7469707461702d76616c69646174696f6e267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d4261636b2d656e642b5469707461702b656469746f722b76616c69646174696f6e2b72756c6573266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d3735707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/5fdbe1db596451ef00b81d2351f2f21925e29fc4e611b01e2c6a17b290ea9322/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c25323054697074617025323076616c69646174696f6e2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6a61636f626669747a702532466c61726176656c2d7469707461702d76616c69646174696f6e267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d4261636b2d656e642b5469707461702b656469746f722b76616c69646174696f6e2b72756c6573266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d3735707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

[![Latest Version on Packagist](https://camo.githubusercontent.com/feacbf440e134d8f053fafdea0b8a1a353bc8d174b80a5305bea039d1cc75773/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a61636f626669747a702f6c61726176656c2d7469707461702d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jacobfitzp/laravel-tiptap-validation)[![GitHub Tests Action Status](https://camo.githubusercontent.com/9f557845c2919f97214a84d64ce81a9b7e50f837249d42927c94c2d85dd6e581/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a61636f626669747a702f6c61726176656c2d7469707461702d76616c69646174696f6e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/jacobfitzp/laravel-tiptap-validation/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/3ea56f395c415342eb0d6ae302a7fa6c8785d1c613ec215ba1cc82256550ebc0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a61636f626669747a702f6c61726176656c2d7469707461702d76616c69646174696f6e2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/jacobfitzp/laravel-tiptap-validation/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/3a9f01ed712eb457973ebc25e75ce11f6bbd8cde29ab398e394a171a6f6bd3d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a61636f626669747a702f6c61726176656c2d7469707461702d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jacobfitzp/laravel-tiptap-validation)

Configurable Laravel validation rule for [Tiptap editor](https://tiptap.dev/) content.

```
$rules = [
    'tiptap_content' => [
        'required',
        TiptapValidation::content()
            ->whitelist()
            ->nodes('text', 'paragraph')
            ->marks('bold', 'italic', 'link'),
        TiptapValidation::containsText()
            ->between(18, 256),
    ],
];
```

Validate Tiptap content in your back-end to prevent unwanted elements and styling from being used.

### Please note

[](#please-note)

This package only works with JSON output, not the raw HTML. You can read more about outputting Tiptap JSON content [here](https://tiptap.dev/guide/output#option-1-json).

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

[](#installation)

You can install the package via composer:

```
composer require jacobfitzp/laravel-tiptap-validation
```

And then add the service provider to `config/app.php`

```
JacobFitzp\LaravelTiptapValidation\TiptapValidationServiceProvider::class,
```

Usage
-----

[](#usage)

### Content

[](#content)

The `TiptapContent` rule is used to validate the basic structure and format, as well as limit what nodes and marks are allowed.

Simply call `TiptapValidation::content()` within your rules.

```
TiptapValidation::content()
```

#### Blacklisting

[](#blacklisting)

Only nodes and marks which are not specified in the blacklist will be allowed, anything else will fail validation.

```
TiptapValidation::content()
    ->blacklist()
    ->nodes('orderedList', 'listItem')
    ->marks('italic', 'link')
```

#### Whitelisting

[](#whitelisting)

Only specified nodes and marks are allowed, anything not in the whitelist will fail validation.

```
TiptapValidation::content()
    ->whitelist()
    ->nodes('text', 'paragraph')
    ->marks('bold')
```

#### Extension

[](#extension)

Instead of having to configure the rule each time, you could simply create an extension that has your default preferences set.

```
class MyCustomTiptapValidationRule extends TiptapContent
{
    protected TiptapValidationRuleMode $mode = TiptapValidationRuleMode::WHITELIST;
    protected array $nodes = ['text', 'paragraph', 'table'];
    protected array $marks = ['italic', 'link'];
}
```

This can then be used without the need for further configuration:

```
MyCustomTiptapValidationRule::make(),
```

### Contains Text

[](#contains-text)

The `TiptapContainsText` rule is used for verifying that the content contains text, and meets an optional character count requirements.

```
TiptapValidation::containsText()
    ->minimum(12) // Minimum character requirement
    ->maximum(156) // Maximum character requirement
    ->between(12, 156) // Minimum and maximum character requirement
```

Configuration
-------------

[](#configuration)

### Error messages

[](#error-messages)

First publish the translation files:

```
php artisan vendor:publish --provider="JacobFitzp\LaravelTiptapValidation\TiptapValidationServiceProvider" --tag="tiptap-validation-translations"
```

And then you can configure the error messages in `lang/vendor/tiptap-validation/messages.php`

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Jacob Fitzpatrick](https://github.com/JacobFitzp)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.1% 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

Every ~22 days

Recently: every ~27 days

Total

6

Last Release

993d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/780c761e3f0522b0200da41fd247e494ecfd4c745bb50517b8f15828628fd1b0?d=identicon)[JacobFitzp](/maintainers/JacobFitzp)

---

Top Contributors

[![JacobFitzp](https://avatars.githubusercontent.com/u/34043417?v=4)](https://github.com/JacobFitzp "JacobFitzp (27 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

laravelJacobFitzplaravel-tiptap-validation

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/jacobfitzp-laravel-tiptap-validation/health.svg)

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

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[ziming/laravel-zxcvbn

Zxcvbn Password validation rule for Laravel

3056.7k](/packages/ziming-laravel-zxcvbn)[basillangevin/laravel-data-json-schemas

Transforms Spatie Data objects into JSON Schemas with built-in validation

1312.2k1](/packages/basillangevin-laravel-data-json-schemas)[wyattcast44/laravel-safe-username

Laravel vulgar username filter / validation rule.

231.2k](/packages/wyattcast44-laravel-safe-username)

PHPackages © 2026

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