PHPackages                             webworker01/gameoflife - 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. webworker01/gameoflife

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

webworker01/gameoflife
======================

Game of Life in PHP

017PHP

Since Jan 25Pushed 12y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Game of Life in PHP
===================

[](#game-of-life-in-php)

This package implements the Game of Life [http://en.wikipedia.org/wiki/Conway's\_Game\_of\_Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life), a mathematical model in the field of cellular automata [http://en.wikipedia.org/wiki/Cellular\_automata](http://en.wikipedia.org/wiki/Cellular_automata). This field has spawned interesting theories ranging from practical (random number generation) to philosophical [http://www.youtube.com/watch?v=YOxDb\_BbXzU](http://www.youtube.com/watch?v=YOxDb_BbXzU).

In the Game of Life we have a grid (of undetermined size) seeded with a number of cells considered live and arranged in a starting configuration at various points in the grid. Each live cell in the grid will be represented in the program as a boolean true.

A timer function scans the entire grid and applies the following four simple rules:

1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
2. Any live cell with two or three live neighbours lives on to the next generation.
3. Any live cell with more than three live neighbours dies, as if by overcrowding.
4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

The timer then continues ad infinitum, applying these rules to all cells in the grid simultaneously.

Getting Started
---------------

[](#getting-started)

To start using this library add the following lines to your composer.json

```
"require": {
    "webworker01/gameoflife": "dev-master"
}

```

A simple example to get started with the library

```
//Add composer autoloader
require 'vendor/autoload.php';

use webworker01\gameoflife;

//See if we have a map stored already for the session
if (empty($_SESSION['map'])) {
    $map = new webworker01\gameoflife\Map(80, 75);
    $map->seed();
} else {
    $map = unserialize($_SESSION['map']);
    $map->tick();
}
$_SESSION['map'] = serialize($map);

```

From here you can simply print out some HTML to see the current generation of the map

```

...

...

```

Or for a more animated version, use the included jquery plugin in your HTML

```

        $(function() {
            $('#gameoflife').gameoflife({
                coordinates: ;
            });
        });

```

Why Another Game of Life?
-------------------------

[](#why-another-game-of-life)

I'm just doing this for fun and would like to expand my knowledge in the concepts mentioned above.

Future Features
---------------

[](#future-features)

In this interpretation of the Game of Life we will strive to add some additional functionality, time permitting:

- Add a color based system to cells to add variables such as \*\* Longevity of a cell \*\* "Dead zones" on the grid \*\* Nomad cells
- Saving interesting starting configurations based on final states of infinite loops of repeated movement
- Allow for user input of some sort to modify the seeding configurations
- Additional views \*\* Animated GIF/PNG \*\* HTML5 Canvas

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a2120286bceeadf46e5923813400b991a6642a85f4df84132872379ec6fadb8e?d=identicon)[webworker01](/maintainers/webworker01)

---

Top Contributors

[![webworker01](https://avatars.githubusercontent.com/u/3256000?v=4)](https://github.com/webworker01 "webworker01 (47 commits)")

### Embed Badge

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

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

###  Alternatives

[adigital/help-links

Define useful links to be added to the dashboard for clients.

102.0k](/packages/adigital-help-links)[burnbright/silverstripe-bootstrap

Boilerplate theme, using bootstrap

101.0k](/packages/burnbright-silverstripe-bootstrap)

PHPackages © 2026

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