PHPackages                             parable-php/getset - 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. parable-php/getset

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

parable-php/getset
==================

Parable GetSet helps with easily building value sets

1.0.1(1y ago)15171MITPHPPHP &gt;=8.0

Since Mar 6Pushed 1y ago1 watchersCompare

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

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

Parable GetSet
==============

[](#parable-getset)

[![Workflow Status](https://github.com/parable-php/getset/workflows/Tests/badge.svg)](https://github.com/parable-php/getset/actions?query=workflow%3ATests)[![Latest Stable Version](https://camo.githubusercontent.com/37fd47d2379e4b01cb9f9a47da76c13ecfc755a0058bbbe9fba68b44031a8e4c/68747470733a2f2f706f7365722e707567782e6f72672f70617261626c652d7068702f6765747365742f762f737461626c65)](https://packagist.org/packages/parable-php/getset)[![Latest Unstable Version](https://camo.githubusercontent.com/78086ab9537e6929df7f17913501db4af9a0391fc9c6d2955bb034bfba1fdaf0/68747470733a2f2f706f7365722e707567782e6f72672f70617261626c652d7068702f6765747365742f762f756e737461626c65)](https://packagist.org/packages/parable-php/getset)[![License](https://camo.githubusercontent.com/7d4576fc98102e9189134d7607e962fd23bb680ed4297f1907299970ba47b353/68747470733a2f2f706f7365722e707567782e6f72672f70617261626c652d7068702f6765747365742f6c6963656e7365)](https://packagist.org/packages/parable-php/getset)

Parable GetSet allows for clean and intuitive handling of global variables such as `$_GET` and `$_SERVER` using value collections, in addition to resource objects with their own scope.

The major benefit is dot-notation (`key.string`) for nested values, such as `$getCollection->get('this.is.nested');`, which will look in the `GetCollection`'s stored values for `['this']['is']['nested']`.

Collections always return the requested value or `null` by default, allowing the predictable use of null coalescing.

Install
-------

[](#install)

Php 8.0+ and [composer](https://getcomposer.org) are required.

```
$ composer require parable-php/getset
```

Usage
-----

[](#usage)

Assuming a query string like: `?id=345&user[name]=username`:

```
$getCollection = new \Parable\GetSet\GetCollection();

echo $getCollection->get('id');
echo ':';
echo $getCollection->get('user.name');
```

Would output `345:username`

Obviously you can also set values directly:

```
$getCollection->set('settings.mail.from', 'me@system');

// later

$mail_from = $getCollection->get('settings.mail.from') ?? 'nobody';
```

The Collections
---------------

[](#the-collections)

#### Global Collections

[](#global-collections)

These correspond to their `$_NAME` global variables, also found in the super-global `$GLOBALS` variable.

- `CookieCollection`, handles `$_COOKIE` data.
- `FilesCollection`, handles `$_FILES` data.
- `GetCollection`, handles `$_GET` data.
- `PostCollection`, handles `$_POST` data.
- `ServerCollection`, handles `$_SERVER` data.
- `SessionCollection`, handles `$_SESSION` data.

#### Local Resource Collections

[](#local-resource-collections)

- `DataCollection`, a generic collection using only a local resource, useful for passing data throughout an application. Think configuration.
- `InputStreamCollection`, to read out an input stream. Can import/parse `json` or query string data.

#### Your own custom Collections!

[](#your-own-custom-collections)

You can easily build your own collections by extending the `BaseCollection` class and co-opting the easy dot-notation get/set logic.

API
---

[](#api)

- `getAll(): array` - returns all values currently stored
- `getAllAndClear(): array` - returns all values currently stored and then clears them
- `get(string $key, $default = null): mixed` - returns value by key or `$default` if not found
- `getAndRemove(string $key): mixed` - returns value by key and then removes it, or throw exception if it doesn't exist
- `set(string $key, $value): void` - set a value by key
- `setMany(array $values): void` - set all values passed one-by-one, overwriting pre-existing values
- `setAll(array $values): void` - set all values, overwriting any pre-existing ones
- `remove(string $key): void` - remove by key, if already removed, throws
- `clear(): void` - removes all values
- `has(string $key): bool` - returns whether the passed key (or `key.string`) currently exists
- `count(): int` - returns number of root value items (not all nested values)

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

[](#contributing)

Any suggestions, bug reports or general feedback is welcome. Use github issues and pull requests, or find me over at [devvoh.com](https://devvoh.com).

License
-------

[](#license)

All Parable components are open-source software, licensed under the MIT license.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance42

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity71

Established project with proven stability

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

Recently: every ~447 days

Total

9

Last Release

471d ago

Major Versions

0.3.0 → 1.0.02021-03-12

PHP version history (2 changes)0.1.0PHP &gt;=7.1

0.2.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7db40df70c77a9d591de4521642b0ddcb6c448e4876b22dc2f76900c736ab579?d=identicon)[robindevoh](/maintainers/robindevoh)

---

Top Contributors

[![devvoh](https://avatars.githubusercontent.com/u/7500415?v=4)](https://github.com/devvoh "devvoh (1 commits)")

---

Tags

dataparablephp8superglobalsvaluesmicrolibraryvaluesparable

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/parable-php-getset/health.svg)

```
[![Health](https://phpackages.com/badges/parable-php-getset/health.svg)](https://phpackages.com/packages/parable-php-getset)
```

###  Alternatives

[devster/ubench

Micro PHP library for benchmarking

5701.0M29](/packages/devster-ubench)[league/iso3166

ISO 3166-1 PHP Library

69536.3M116](/packages/league-iso3166)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

296.6M2](/packages/dekor-php-array-table)

PHPackages © 2026

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