PHPackages                             pklink/dotor - 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. pklink/dotor

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

pklink/dotor
============

Easy access to array values using dot notation. Useful for handling configurations or something like that

2.0.0(10y ago)3738BSD-2-ClausePHPPHP &gt;=5.6.0

Since Feb 11Pushed 10y ago1 watchersCompare

[ Source](https://github.com/pklink/dotor)[ Packagist](https://packagist.org/packages/pklink/dotor)[ Docs](https://github.com/pklink/dotor)[ RSS](/packages/pklink-dotor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (10)Used By (0)

Dotor [![Build Status](https://camo.githubusercontent.com/6a67176376e0a5e11ed1aad83b79e5d61df233df45affe494b548f6f2d293f13/68747470733a2f2f7472617669732d63692e6f72672f706b6c696e6b2f646f746f722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/pklink/dotor) [![Scrutinizer Quality Score](https://camo.githubusercontent.com/0cb7514f90c27b96d0ab163855d26219e688464b7dd3ddebfe8cae7067e138b1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706b6c696e6b2f646f746f722f6261646765732f7175616c6974792d73636f72652e706e673f733d38333339653735383765653266333331653639326432396133303466346539376432343535666163)](https://scrutinizer-ci.com/g/pklink/dotor/)
====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#dotor--)

Dotor is a library for PHP 5.6 and higher to access an array by using dot notification. This can be useful for handling array configurations or something like that

Installation
------------

[](#installation)

Install Dotor with [Composer](http://getcomposer.org/)

Create or update your `composer.json`

```
{
    "require": {
        "pklink/dotor": "2.*"
    }
}
```

And run Composer

```
php composer.phar install
```

Finally include Composers autoloader

```
include __DIR__ . '/vendor/autoload.php';
```

Usage
-----

[](#usage)

Using `Dotor is very simple. Create an instance with your (configurarion) array...

```
// config-sample.php
return [
    'name' => 'sample configuration',
    'database' => [
        'server'   => 'localhost',
        'username' => 'root',
        'password' => 'password',
        'database' => 'blah',
        'type'     => 'sqlite'
    ],
    'object' => new stdClass(),
    'false'      => false,
    'true'       => true,
    'zeroString' => '0',
    'zeroInt'    => 0,
    'oneString'  => '1',
    'oneInt'     => 1,
    'twoString'  => '2',
];
```

```
$loader = ArrayLoader::createFromFile('./config-sample.php');
$config = new Dotor($loader);
```

... and get the content by the `get()`-method.

```
$config->get('name');
$config->get('database.server');
```

### Default values

[](#default-values)

```
$config->get('asdasdas');         // returns null
$config->get('asdasdas', 'blah'); // returns 'blah'
```

### Scalar values

[](#scalar-values)

```
$config->getScalar('object');           // returns ''
$config->getScalar('object', 'blah');   // returns 'blah'
$config->getScalar('not-existing');     // returns ''
$config->getScalar('not-existing', []); // throw InvalidArgumentException
```

### Arrays

[](#arrays)

```
$config->getArray('database');      // returns the database array
$config->getArray('notexit');       // returns []
$config->getArray('notexit', [1]);  // returns [1]
```

### Boolean

[](#boolean)

```
$config->getBoolean('database', false);   // returns false
$config->getBool('database', true);       // returns true
$config->getBoolean('zeroString', true);  // returns false
$config->getBoolean('zeroInt', true);     // returns false
$config->getBoolean('oneString', false);  // returns true
$config->getBoolean('oneInt', false);     // returns true
```

The `getBoolean()`-method and their alias `getBool()` handle the string `'1'` and the integer `1` as `true`. Otherwise this method returns the given `$default` or `true`.

```
$config->getBoolean('oneString', false);   // returns true
$config->getBoolean('twoString', false);   // returns false
$config->getBoolean('twoString');          // returns true
```

Run tests
---------

[](#run-tests)

```
php composer.phar install --dev
php vendor/bin/phpunit tests/
```

or with code-coverage-report

```
php composer.phar install --dev
php vendor/bin/phpunit --coverage-html output tests/
```

License
-------

[](#license)

This package is licensed under the BSD 2-Clause License. See the LICENSE file for details.

Credits
-------

[](#credits)

This package is inspired by [php-dotty](https://github.com/thesmart/php-dotty)

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

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

Recently: every ~260 days

Total

9

Last Release

3779d ago

Major Versions

0.2 → 1.0.02014-02-16

1.1.0 → 2.0.02016-01-03

PHP version history (3 changes)0.1PHP &gt;=5.3.0

0.1.1PHP &gt;=5.4.0

2.0.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c8c5e958e572c9805a2746a44c66ffd72fdfb22f1f5c7f0723a40afee9ec176?d=identicon)[pklink](/maintainers/pklink)

---

Top Contributors

[![pklink](https://avatars.githubusercontent.com/u/753350?v=4)](https://github.com/pklink "pklink (7 commits)")

---

Tags

configurationSettingsarrayconfigdotdot notation

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[league/config

Define configuration arrays with strict schemas and access values with dot notation

564302.2M24](/packages/league-config)[dmishh/settings-bundle

Database centric Symfony configuration management. Global and per-user settings supported.

115254.9k1](/packages/dmishh-settings-bundle)[illuminatech/array-factory

Allows DI aware object creation from array definition

2159.6k5](/packages/illuminatech-array-factory)[michaels/data-manager

Simple data manager for nested data, dot notation array access, extendability, and container interoperability.

121.9k2](/packages/michaels-data-manager)

PHPackages © 2026

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