PHPackages                             wookieb/map - 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. wookieb/map

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

wookieb/map
===========

Implementation of map in PHP

0.1.2(12y ago)15311MITPHP

Since Sep 12Pushed 12y ago1 watchersCompare

[ Source](https://github.com/wookieb/map)[ Packagist](https://packagist.org/packages/wookieb/map)[ RSS](/packages/wookieb-map/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (4)Used By (1)

Map
===

[](#map)

[![Build Status](https://camo.githubusercontent.com/6ca529624a27bf49e961dd2d410310af80b43172ebe7a280c9680c265d2a5003/68747470733a2f2f7472617669732d63692e6f72672f776f6f6b6965622f6d61702e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/wookieb/map)Implementation of map data type for PHP. Allows to use non-scalar keys like objects, arrays.

Install
-------

[](#install)

Via composer

```
    "require": {
        "wookieb/map": "0.1"
    }
```

Example
-------

[](#example)

```
use Wookieb\Map\Map;

$map = new Map();

$object = new stdClass();

$map->add(true, 'that\'s true');
$map->add($object, 'some object');
$map->add('key', 'value');

$map->get(true); // that's true
$map->get($object); // some object
$map->get('key'); // value
```

Iteration
---------

[](#iteration)

Since map may contains some non-scalar keys so iteration is different. For php &lt; 5.5 you will receive a MapEntry object instead of value of current element in iteration. For php &gt;= 5.5 iteration works normally.

```
use Wookieb\Map\Map;

$map = new Map();
$map->add('yearly', 'ketchup');

// for php < 5.5
foreach ($map as $entry) {
    list($key, $value) = $entry->get();
    $key; // yearly
    $value; // ketchup
    // or
    $entry->getKey(); // yearly
    $entry->getValue(); // ketchup
}

// for php >= 5.5
foreach ($map as $key => $value) {
    $key; // yearly
    $value; // ketchup
}

// forcing map to use MapEntry objects
$map = new Map(true);
$map->add('yearly', 'ketchup');

// for every php version
foreach ($map as $entry) {
    list($key, $value) = $entry->get();
}
```

Changelog
=========

[](#changelog)

0.1.2
-----

[](#012)

- added isUsingMapEntries method

0.1.1
-----

[](#011)

- added StrictMapTypeCheck

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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

Total

3

Last Release

4673d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/542596?v=4)[Łukasz Kużyński](/maintainers/wookieb)[@wookieb](https://github.com/wookieb)

---

Top Contributors

[![wookieb](https://avatars.githubusercontent.com/u/542596?v=4)](https://github.com/wookieb "wookieb (8 commits)")

---

Tags

mapdata structure

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[phpcollection/phpcollection

General-Purpose Collection Library for PHP

1.0k64.7M34](/packages/phpcollection-phpcollection)[dasprid/enum

PHP 7.1 enum implementation

382165.7M12](/packages/dasprid-enum)[marc-mabe/php-enum

Simple and fast implementation of enumerations with native PHP

50458.3M110](/packages/marc-mabe-php-enum)[aimeos/map

Easy and elegant handling of PHP arrays as array-like collection objects similar to jQuery and Laravel Collections

4.3k459.4k15](/packages/aimeos-map)[spatie/geocoder

Geocoding addresses to coordinates

8555.2M19](/packages/spatie-geocoder)[dusank/knapsack

Collection library for PHP

5391.0M25](/packages/dusank-knapsack)

PHPackages © 2026

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