PHPackages                             hashbangcode/webolution - 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. hashbangcode/webolution

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

hashbangcode/webolution
=======================

Webolution, an evolution engine.

2.0.7(4y ago)152MITPHPPHP &gt;=7.1CI failing

Since Nov 14Pushed 4y ago1 watchersCompare

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

READMEChangelog (8)Dependencies (4)Versions (10)Used By (0)

Webolution
==========

[](#webolution)

An experimental set of classes that attempts to put together an application that will evolve a webpage. This is intended to be a test application that allows me to learn the techniques involved in genetic algorithms as well as how to to put together a modern PHP application with composer. As a result things might change significantly without warning.

I'm interested in finding out if anyone has looked at this code or has any suggestions for improvement. Please get in touch via the issue queue and let me know.

Requirements
============

[](#requirements)

- PHP (preferably 7.2+).
- Composer.

Structure
=========

[](#structure)

The application is structured into different types of objects in order to ensure separate concerns.

Types
-----

[](#types)

The types classes take care of the data types at the core of the evolution process. At it's core a *Type* class only cares about the data that it contains. *Type* classes do not have functionliaty to perform mutations or calculate fitness metrics, this is the domain of Individual classes.

Individuals
-----------

[](#individuals)

*Individual* classes provide mutation and fitness functionality for Type classes. Instead of extending the types they wrap them as a parameter. *Individual* classes can be regarded as decorators of the *Type* classes. Each *Type* class maps to an *Individual* class.

Populations
-----------

[](#populations)

The *Population* class provides a collection of *Individuals*.

Evolution
---------

[](#evolution)

An Evolution class is used to control the process of evolution. This ties together the *Population*, *Individual* and *Type* classes and controls each generation of *Population* objects. An *EvolutionStorage* class has been created to allow larger number of *Individuals* to be evolved at once using a database as a storage engine.

Types Detail
============

[](#types-detail)

The following details each of the types and any interactions they have with other types.

Number
------

[](#number)

Defines a class that contains a number. The NumberType class can add or subtract from this number. It was created as a very simple initial type in order to test the functionality of the evolution process.

Text
----

[](#text)

Defines a class that contains a string. The class has functions to get or set the string.

Color
-----

[](#color)

Defines a class that contains information about a color. This is stored internally by the RGB value of the color.

Image
-----

[](#image)

This defines a 2 dimensional array that renders out into an image. The array consists of either “on” or “off” values, which are then used to create a grid of boxes in an image.

Element
-------

[](#element)

This represents a HTML element. The core property is the element type (div, p, strong etc) and one or more attributes. The attributes can be used to give the elements a class or id, although any attribute is allowed. An *Element* object can also contain one or more child *Element* objects, which creates a hierarchical structure of *Elements*.

Unit
----

[](#unit)

The Unit is an object that holds information about a measurement in CSS. This is represented by a number and a unit of measurement. So values like 10px, 10em, 10% can exist. A special value of ‘auto’ can also be represented.

Style
-----

[](#style)

This defines an object that contains information about a CSS rule set against a single element. The class contains a selector property and an attributes property that combine together to form a CSS block.

Page
----

[](#page)

A Page brings together the *Style* and *Element* classes into a page structure. The use of the *Page* class allows the basic HTML structure of a page to be static whilst the elements and styles within it can change.

The Evolution Process
=====================

[](#the-evolution-process)

The following describes how the process of evolution works for each generation.

Culling
-------

[](#culling)

To start the evolution process a certain amount of the population is removed. The chances of an individual being removed are dependent of the fitness of the individual. Individuals with a high fitness are less likely to be removed.

Replicate
---------

[](#replicate)

The existing individuals in the population are then replicated to bring the population number back to a designated minimum. This means that the current population will contain the fittest individuals.

Mutate
------

[](#mutate)

The population is then randomly mutated. How the population is mutated is dependent on the type of object being used. After the population has been through the mutation cycle the population can then go through a crossover cycle. This is where individuals are mixed together and their attributes are swapped.

Generate Statistics
-------------------

[](#generate-statistics)

Any statistics for the population are then calculated.

Storage
-------

[](#storage)

This action clones the population into an array to that it can be retrieved later. This is important when looking through the history of the population.

Next steps
==========

[](#next-steps)

Some things that need to happen.

- Have a look at performance. Lots of objects being created can use up a lot of memory maybe look at only storing the top (or bottom) individuals in a population instead of everything.
- The way in which the TextIndividual works out it's fitness is based on an external factor. As such it would be better to abstract that functionality out so that it's not just this class that has this functionality.

Future plans
============

[](#future-plans)

- Add a dependency injection container to streamline the use of the application in other applications.
- Generate a family tree of individuals.
- Performance testing and improvements.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.9% 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 ~100 days

Recently: every ~195 days

Total

9

Last Release

1617d ago

Major Versions

1.0.0 → 2.0.02019-12-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a43eee9430019871446300fa61dcd316cfc9cbab38d9d16a73273d07f93927f?d=identicon)[philipnorton42](/maintainers/philipnorton42)

---

Top Contributors

[![philipnorton42](https://avatars.githubusercontent.com/u/150767?v=4)](https://github.com/philipnorton42 "philipnorton42 (418 commits)")[![AccessPhil](https://avatars.githubusercontent.com/u/1881866?v=4)](https://github.com/AccessPhil "AccessPhil (37 commits)")

---

Tags

evolutionwebolution

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hashbangcode-webolution/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M731](/packages/sylius-sylius)[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k14.2M62](/packages/knuckleswtf-scribe)[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k78.3k89](/packages/pocketmine-pocketmine-mp)[verbb/formie

The most user-friendly forms plugin for Craft.

102393.6k59](/packages/verbb-formie)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k17](/packages/solspace-craft-freeform)[bowphp/framework

The bow PHP Framework

6016.7k13](/packages/bowphp-framework)

PHPackages © 2026

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