PHPackages                             chi-teck/trafaret - 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. chi-teck/trafaret

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

chi-teck/trafaret
=================

Trafaret data processor

1.0.0(4y ago)19511MITPHPPHP &gt;=7.3

Since Sep 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Chi-teck/trafaret)[ Packagist](https://packagist.org/packages/chi-teck/trafaret)[ RSS](/packages/chi-teck-trafaret/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (7)Used By (1)

Trafaret
========

[](#trafaret)

[![Build Status](https://github.com/Chi-teck/trafaret/workflows/Tests/badge.svg)](https://github.com/Chi-teck/trafaret/workflows/Tests/badge.svg)

A simple way to extract data from multiline textual snippets.

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

[](#installation)

`composer require chi-teck/trafaret --dev`

Usage
-----

[](#usage)

```
$input =  new GreaterThan(10),
    ],
);

$manager = Manager::createDefault();

try {
    $data = $manager->apply($trafaret, $input);
}
catch (ExceptionInterface $exception) {
    \file_put_contents('php://stderr', $exception->getMessage() . "\n");
    exit(1);
}

print_r($data);
```

Placeholders are validated using [Symfony Validator](https://symfony.com/doc/current/components/validator.html).

For tests based on PHPUnit you can make use of TrafaretTrait to validate markup as shown below.

```
final class HomePageTest extends SiteTestCase
{
    use TrafaretTrait;

    public function testMarkup(): void
    {
        $trafaret = Trafaret::createFromFile(__DIR__ . '/../fixtures/home-page.html.trf');
        $actual_html = $this->findByXpath('//div[@class = "page"]')->getOuterHtml();
        $this->assertStringByTrafaret($trafaret, $actual_html);
    }
}
```

License
-------

[](#license)

MIT License

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

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

Every ~106 days

Recently: every ~133 days

Total

6

Last Release

1535d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/673139?v=4)[Ivan](/maintainers/chi-teck)[@Chi-teck](https://github.com/Chi-teck)

---

Top Contributors

[![Chi-teck](https://avatars.githubusercontent.com/u/673139?v=4)](https://github.com/Chi-teck "Chi-teck (47 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/chi-teck-trafaret/health.svg)

```
[![Health](https://phpackages.com/badges/chi-teck-trafaret/health.svg)](https://phpackages.com/packages/chi-teck-trafaret)
```

###  Alternatives

[rollerworks/password-strength-validator

Password-strength validator for Symfony

1455.7M6](/packages/rollerworks-password-strength-validator)[karser/karser-recaptcha3-bundle

Google ReCAPTCHA v3 for Symfony

1862.4M7](/packages/karser-karser-recaptcha3-bundle)[barbieswimcrew/zip-code-validator

Constraint class for international zipcode validation

772.3M](/packages/barbieswimcrew-zip-code-validator)[sllh/iso-codes-validator

Symfony validator wrapper of ronanguilloux/isocodes

37299.8k2](/packages/sllh-iso-codes-validator)[jbafford/password-strength-bundle

Provides a password strength validator

28468.6k](/packages/jbafford-password-strength-bundle)[happyr/entity-exists-validation-constraint

Verify that your entity exists

31180.4k](/packages/happyr-entity-exists-validation-constraint)

PHPackages © 2026

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