thoma127/dict

A simple PHP class for Python dictionary-like functionality.

Maintainers

Details

github.com/truetone/Dict

Source

Issues

Installs: 62

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/thoma127/dict

v0.1.3 2018-02-18 15:00 UTC

This package is not auto-updated.

Last update: 2025-10-26 02:04:31 UTC


README

This is a simple PHP class to mimic some of the behavior of a Python dictionary.

Namely, easily storing and retrieving arbitrary data by key reference.

Usage

$data = ["foo" => "bar"];
$dict = new \UMN\CEHD\Dict\Dict($data);

$foo = $dict->get("foo"); // will be "bar"
$baz = $dict->get("baz"); // will be null
$json = $dict->toJSON(); // will be {"foo":"bar"} (string)

$array = $dict->toArray();

var_dump($array);

array(1) {
  'foo' =>
  string(3) "bar"
}