PHPackages                             mateodioev/string-vars - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mateodioev/string-vars

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mateodioev/string-vars
======================

Get vars from string

v1.2.2(2y ago)3275↑66.7%2MITPHPPHP &gt;=8.1

Since Jun 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Mateodioev/string-vars)[ Packagist](https://packagist.org/packages/mateodioev/string-vars)[ RSS](/packages/mateodioev-string-vars/feed)WikiDiscussions main Synced 1mo ago

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

String Vars
===========

[](#string-vars)

Get vars from a string

Install
-------

[](#install)

```
composer require mateodioev/string-vars
```

```
use Mateodioev\StringVars\{Config, Matcher};
```

Example:

```
$matcher = new Matcher(format: "Hello {name}");

// Validate input
var_dump($matcher->isValid('Hello Juan')); // true
var_dump($matcher->isValid('Hello _ Juan')); // false

$vars = $matcher->match('Hello Juan'); // $vars contain an array of parameters
var_dump($vars['name']); // "Juan"
```

Match with data types
---------------------

[](#match-with-data-types)

```
// "w": all string
// "d": all numbers
// "f": all decimals
// "all": all characters
// "": all characters except /
$matcher = new Matcher(format: "Hello {w:name}");
```

Using custom formats
--------------------

[](#using-custom-formats)

```
$conf = new Config();

// This match only decimals numbers
$conf->addFormat('c', '([\d]+\.[\d]+)');

$matcher = new Matcher('The price is {c:price}', $conf);

var_dump($matcher->isValid('The price is 33.03')); // true
var_dump($matcher->isValid('The price is 33')); // false

$vars = $matcher->match('The price is 33.03');
var_dump($vars['price']); // "33.03"
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

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 ~25 days

Recently: every ~31 days

Total

6

Last Release

941d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/77e3f2a5c4e98caf6e911141af3d18235c658500e8b9e0a95ec251a803a39676?d=identicon)[Mateodioev](/maintainers/Mateodioev)

---

Top Contributors

[![Mateodioev](https://avatars.githubusercontent.com/u/68271130?v=4)](https://github.com/Mateodioev "Mateodioev (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mateodioev-string-vars/health.svg)

```
[![Health](https://phpackages.com/badges/mateodioev-string-vars/health.svg)](https://phpackages.com/packages/mateodioev-string-vars)
```

###  Alternatives

[xaboy/form-builder

好用的PHP表单生成器，快速生成现代化的form表单,支持前后端分离。内置17种常用表单组件。目前在政务系统、OA系统、ERP系统、电商系统、流程管理等系统中已稳定应用。

76275.0k5](/packages/xaboy-form-builder)

PHPackages © 2026

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