PHPackages                             messere/php-value-mask - 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. [Search &amp; Filtering](/categories/search)
4. /
5. messere/php-value-mask

ActiveLibrary[Search &amp; Filtering](/categories/search)

messere/php-value-mask
======================

extract subset of array / object values

0.1.2(5y ago)945.8k↓19.2%11MITPHPPHP ^7.1 || ^8.0CI failing

Since Jul 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Messere/php-value-mask)[ Packagist](https://packagist.org/packages/messere/php-value-mask)[ Docs](https://github.com/Messere/php-value-mask)[ RSS](/packages/messere-php-value-mask/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (1)

php-value-mask
==============

[](#php-value-mask)

[![Packagist](https://camo.githubusercontent.com/97d4da0306d41f63a8e74a08b293edac0eff70963c19b6b568bb6d8c69363a6d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6573736572652f7068702d76616c75652d6d61736b2e737667)](https://packagist.org/packages/messere/php-value-mask)

Purpose
-------

[](#purpose)

Google in their [Performance Tips](https://cloud.google.com/storage/docs/json_api/v1/how-tos/performance#partial-response) for APIs, suggest to limit required bandwidth by filtering out unused fields in response. Their APIs support additional URL parameter `fields` which asks API to include only specific fields in response.

`fields` parameter follows a simple syntax, which allows to query for nested keys, multiple keys or use wildcard to include all fields (see *Syntax* and *Grammar* sections below).

This library implements parsing of `fields` parameter and filtering of arrays / objects.

See also: PSR-15 compatible middleware based on this library: [Partial Response PSR-15 Middleware](https://github.com/Messere/partial-response-middleware)

Usage example
-------------

[](#usage-example)

```
