PHPackages                             dotty/dotty - 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. dotty/dotty

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

dotty/dotty
===========

Easy access to array data using dot notation

v0.0.12(13y ago)1293.8k31MITPHPPHP &gt;=5.3.0

Since Jul 9Pushed 12y ago1 watchersCompare

[ Source](https://github.com/thesmart/php-dotty)[ Packagist](https://packagist.org/packages/dotty/dotty)[ Docs](https://github.com/thesmart/php-dotty)[ RSS](/packages/dotty-dotty/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (11)Used By (1)

php-dotty
=========

[](#php-dotty)

Access array data quickly using dot notation.

Whats the big deal?
===================

[](#whats-the-big-deal)

Getting hit in the face with a data fire-hose is painful. Enter Dotty.

```
$allIds	= Dotty::with($data)->set('data.users.id')->result();

```

Install
=======

[](#install)

Install composer:

```
$ curl -s http://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

```

Create a composer.json manifest:

```
$ cd ~/your-project-folder
$ echo "{}" > composer.json

```

Require Dotty:

```
$ composer require dotty/dotty
// specify 0.0.*

```

Link to composer packages in your PHP:

```
// Load vendor libraries
require 'vendor/autoload.php';

```

Done.

Example
=======

[](#example)

```
{
   "data": [
      {
         "name": "Farenheit 451",
         "category": "Book",
         "id": "114836791862134",
         "created_time": "2010-09-30T19:36:29+0000"
      },
      {
         "name": "Coders at work",
         "category": "Book",
         "id": "104178566283955",
         "created_time": "2010-09-30T19:20:50+0000"
      },
      {
         "name": "Age of Spiritual Machines",
         "category": "Book",
         "id": "114114031939540",
         "created_time": "2010-09-30T19:20:50+0000"
      },
      {
         "name": "The Internets",
         "category": "Book",
         "id": "104303812934779",
         "created_time": "2010-05-03T19:36:18+0000"
      },
      {
         "name": "Ender's Game",
         "category": "Book",
         "id": "108178452537550",
         "created_time": "2010-05-03T19:36:18+0000"
      },
      {
         "name": "Catcher In The Rye",
         "category": "Book",
         "id": "115946728419025",
         "created_time": "2010-05-03T19:36:18+0000"
      },
      {
         "name": "George Orwell",
         "category": "Author",
         "id": "108663695825202",
         "created_time": "2010-05-03T19:36:18+0000"
      }
   ]
}

```

**TAME THE BEAST!**

```
$data	= json_decode($data, true);
$names	= Dotty::with($data)->set('data.name')->result();
echo json_encode($names);

["Farenheit 451","Coders at work","Age of Spiritual Machines","The Internets","Ender's Game","Catcher In The Rye","George Orwell"]

// chain commands together
Dotty::with($data)->one('data')->set('name');

["Farenheit 451","Coders at work","Age of Spiritual Machines","The Internets","Ender's Game","Catcher In The Rye","George Orwell"]

```

Dotty Notation
==============

[](#dotty-notation)

Notation in dotty is simple. Consider again the dataset above:

```
// finds a specific value at an exact address
Dotty::with($data)->one('data[1].name');

// finds the first sub-node matching a key
Dotty::with($data)->first('name');

// finds all sub-nodes matching a key (even at different levels in the data)
Dotty::with($data)->all('name');

```

**WARNING** above, when I say pulls *ALL* sub-nodes, does not stop at a specific level in the data tree.

```
// takes everything before the last dot, and uses it for a "one" operation
// uses the last symbol, uses it for an "all" operation
Dotty::with($data)->set('data.name');

```

Mutation
========

[](#mutation)

With Dotty, you can also modify a data-set easily. Consider again the dataset above:

```
echo $data['data'][1]['name'];
echo "\n";

// correct the title casing so that "work" is upercase
$names		= &Dotty::with($data)->set('data.name');
$names[1]	= mb_convert_case($names[1], MB_CASE_TITLE);

echo $names[1];
echo "\n";
echo $data['data'][1]['name'];

```

Behold, the power of the dark side:

```
Coders at work
Coders at Work
Coders at Work

```

**NOTE** you have to designate that you want Dotty's return value by reference

```
&Dotty::with($data)...

```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.8% 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 ~1 days

Total

10

Last Release

5044d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/11f682ea6d98e41ccb56db0a284ac5b085fd31d40c3119cf8c3e493f87498c0a?d=identicon)[thesmart](/maintainers/thesmart)

---

Top Contributors

[![thesmart](https://avatars.githubusercontent.com/u/280877?v=4)](https://github.com/thesmart "thesmart (15 commits)")[![djsipe](https://avatars.githubusercontent.com/u/698224?v=4)](https://github.com/djsipe "djsipe (1 commits)")

---

Tags

jsonsearcharrayquerynotationarrays

### Embed Badge

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

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

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)[athari/yalinqo

YaLinqo, a LINQ-to-objects library for PHP

4561.2M5](/packages/athari-yalinqo)[jbzoo/data

An extended version of the ArrayObject object for working with system settings or just for working with data arrays

891.6M23](/packages/jbzoo-data)[rpnzl/arrch

Array queries for PHP 5.3

37134.6k2](/packages/rpnzl-arrch)[nahid/qarray

QArray is a PHP abstraction for querying array

108403.2k2](/packages/nahid-qarray)

PHPackages © 2026

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