PHPackages                             merlinthemagic/mtm-memory - 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. merlinthemagic/mtm-memory

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

merlinthemagic/mtm-memory
=========================

Shared Memory tools for PHP 7

06PHP

Since Dec 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/merlinthemagic/MTM-Memory)[ Packagist](https://packagist.org/packages/merlinthemagic/mtm-memory)[ RSS](/packages/merlinthemagic-mtm-memory/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

MTM-Memory
==========

[](#mtm-memory)

Shmop:
------

[](#shmop)

### Get a shared memory segment:

[](#get-a-shared-memory-segment)

```
$factObj	= \MTM\Memory\Factories::getShared()->getSystemFive(); //get the factory

$name		= "mySegmentName"; //optional, but helps you locate the segment in other processes
$size		= 15000; //number of bytes the segment can use, defaults to 10000
$perm		= "0600"; //permissions on the segment, defaults to 0644
$memObj	= $factObj->getNewShare($name, $size, $perm); //get a new shared memory segment

```

### Write Data:

[](#write-data)

```
$name		= "mySegmentName";
$data		= "somedata"; //mixed
$memObj->set($name, $data); //will aquire a lock (blocking) before writing

```

### Read Data:

[](#read-data)

```
$name		= "mySegmentName";
echo $memObj->get($name); //somedata (will aquire a lock, blocking, before reading

```

### get connection count on a share:

[](#get-connection-count-on-a-share)

```
echo $memObj->getAttachCount(); // number of processes / threads connected to the memory segment

```

### Keep alive:

[](#keep-alive)

```

//if set to false (default), this instance of the share will delete the memory + semaphores if it is the last one
//connected. set to true and this instance will simply terminate and leave the data intact
$bool		= true;
$memObj->setKeepAlive($bool);

```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8021715?v=4)[Martin Peter Madsen](/maintainers/merlinthemagic)[@merlinthemagic](https://github.com/merlinthemagic)

---

Top Contributors

[![merlinthemagic](https://avatars.githubusercontent.com/u/8021715?v=4)](https://github.com/merlinthemagic "merlinthemagic (14 commits)")

### Embed Badge

![Health badge](/badges/merlinthemagic-mtm-memory/health.svg)

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

###  Alternatives

[eftec/minilang

A mini scripting language for php

113.2k2](/packages/eftec-minilang)

PHPackages © 2026

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