PHPackages                             hyqo/pair - 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. hyqo/pair

ActiveLibrary

hyqo/pair
=========

1.0.0(3y ago)047↓100%1MITPHPPHP ^7.2|^8.0

Since Mar 5Pushed 3y ago1 watchersCompare

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

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

parse\_pair(string $string): array
==================================

[](#parse_pairstring-string-array)

[![Packagist Version](https://camo.githubusercontent.com/ed1519a23f8ace16a97171677d3acf37aca36663977899f5f3ca96c33e6f26fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6879716f2f706169723f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/ed1519a23f8ace16a97171677d3acf37aca36663977899f5f3ca96c33e6f26fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6879716f2f706169723f7374796c653d666c61742d737175617265)[![Packagist PHP Version Support](https://camo.githubusercontent.com/506efa90aab17c8f09ae67224734f028f16c95c65ba1f19808144546c441bc59/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6879716f2f706169723f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/506efa90aab17c8f09ae67224734f028f16c95c65ba1f19808144546c441bc59/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6879716f2f706169723f7374796c653d666c61742d737175617265)[![GitHub Workflow Status](https://camo.githubusercontent.com/1ea089a38b5f852b22ba4bf381ee3e38867b16e2a1dffe8b0b951023cd9cc03f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6879716f2f706169722f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/1ea089a38b5f852b22ba4bf381ee3e38867b16e2a1dffe8b0b951023cd9cc03f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6879716f2f706169722f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)

Why not parse\_str?
-------------------

[](#why-not-parse_str)

Because `parse_str` works only with a URL query string format.

So `foo="bar"` will be parsed like

```
array(1) {
  ["foo"]=>
  string(5) ""bar""
}

```

We have double-quoted value `"bar"`. Instead, you can use `parse_pair` and if value is a valid double-quoted it will be expanded

Install
-------

[](#install)

```
composer require hyqo/pair
```

Usage
-----

[](#usage)

```
use function Hyqo\Pair\parse_pair;

[$key, $value] = parse_pair('foo="bar"');

echo $key; //foo
echo $bar; //bar
```

If string is valid, it will be parsed:

stringkeyvalue`foo=``foo`empty string`foo=""``foo`empty string`foo=bar``foo``bar``foo="bar"``foo``bar``foo='bar'``foo``bar``foo="\"bar\""``foo``"bar"``foo="\"bar"``foo``"bar``foo="multi\nline"``foo``multi`
`line``foo='multi\nline'``foo``multi`
`line`If string is invalid, result will be `null`:

string`foo="bar\"``foo='bar\'``foo="bar""``foo='bar''`

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

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

Unknown

Total

1

Last Release

1160d ago

### Community

Maintainers

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

---

Top Contributors

[![akeylimepie](https://avatars.githubusercontent.com/u/355106?v=4)](https://github.com/akeylimepie "akeylimepie (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hyqo-pair/health.svg)

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

PHPackages © 2026

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