PHPackages                             redeyeventures/geopattern - 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. redeyeventures/geopattern

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

redeyeventures/geopattern
=========================

Generate beautiful SVG patterns.

v1.1.2(5y ago)11140.8k↑1711.9%20[3 issues](https://github.com/redeyeventures/geopattern-php/issues)[1 PRs](https://github.com/redeyeventures/geopattern-php/pulls)2MITPHP

Since Feb 26Pushed 5y ago6 watchersCompare

[ Source](https://github.com/redeyeventures/geopattern-php)[ Packagist](https://packagist.org/packages/redeyeventures/geopattern)[ RSS](/packages/redeyeventures-geopattern/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (2)

GeoPattern [![Build Status](https://camo.githubusercontent.com/733e6b7aa21916d3f3f186f752fef47796b6867af2c39c9599d40d0a8d8f07bd/68747470733a2f2f7472617669732d63692e6f72672f72656465796576656e74757265732f67656f7061747465726e2d7068702e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/redeyeventures/geopattern-php)
=================================================================================================================================================================================================================================================================================================================================

[](#geopattern-)

[![Latest Version](https://camo.githubusercontent.com/3195a8ff1c3076cdf194c28c6cf54e15c854095f221fe3f789de74f200d80a5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72656465796576656e74757265732f67656f7061747465726e2e7376673f6c6162656c3d737461626c65)](https://packagist.org/packages/redeyeventures/geopattern)[![Latest unstable Version](https://camo.githubusercontent.com/9425ca67d90836fb7fdfd2eff058a856a33de7a78ca1bd261c54868bab9d7d7f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f72656465796576656e74757265732f67656f7061747465726e2e7376673f6c6162656c3d756e737461626c65)](https://packagist.org/packages/redeyeventures/geopattern#dev-master)

This is a PHP port of [jasonlong/geo\_pattern](https://github.com/jasonlong/geo_pattern).

Generate beautiful tiling SVG patterns from a string. The string is converted into a SHA and a color and pattern are determined based on the values in the hash. The color is determined by shifting the hue and saturation from a default (or passed in) base color. One of 16 patterns is used (or you can specify one) and the sizing of the pattern elements is also determined by the hash values.

You can use the generated pattern as the `background-image` for a container. Using the `base64` representation of the pattern still results in SVG rendering, so it looks great on retina displays.

See the [GitHub Guides](http://guides.github.com) site as an example of what this library can do. (GitHub Guides uses the original ruby version).

Installation
------------

[](#installation)

Run this command in your root project:

```
composer require redeyeventures/geopattern
```

Installation (without composer)
-------------------------------

[](#installation-without-composer)

Download or clone the `src` directory from GitHub.

Rename the `src` folder to `GeoPattern` and put it somewhere your app can access it from.

Add this line to your code:

```
require_once('path/to/folder/geopattern_loader.php');

```

You can then follow the usage instructions below.

Usage
-----

[](#usage)

Make a new pattern:

```
$geopattern = new \RedeyeVentures\GeoPattern\GeoPattern();
$geopattern->setString('Mastering Markdown');

```

To specify a base background color (with a hue and saturation that adjusts depending on the string):

```
$geopattern->setBaseColor('#ffcc00');

```

To use a specific background color (w/o any hue or saturation adjustments):

```
$geopattern->setColor('#ffcc00');

```

To use a specific [pattern generator](#available-patterns):

```
$geopattern->setGenerator('sine_waves');

```

Get the SVG string:

```
$svg = $geopattern->toSVG();

```

Get the Base64 encoded string:

```
$base64 = $geopattern->toBase64();

```

Get a data URI:

```
$dataURI = $geopattern->toDataURI(); #data:image/svg+xml;base64,...

```

Get a data URL:

```
$dataURL = $geopattern->toDataURL(); #url("data:image/svg+xml;base64,...")

```

You can use the data URL string to set the background:

```

```

The `setString`, `setBaseColor`, `setGenerator` methods are chainable. You can also pass an array to the GeoPattern constructor containing the `string`, `baseColor`, `color`, and/or `generator` values.

If the GeoPattern object is cast as a string, it will provide the SVG string.

Contributing
------------

[](#contributing)

1. Fork it (  )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Original Project
----------------

[](#original-project)

See [https://github.com/jasonlong/geo\_pattern](https://github.com/jasonlong/geo_pattern) for more info and links to ports for other languages.

Based on jasonlong/geo\_pattern @ ac27b5bb50a8d2061ff63254c915e9ca96a40480.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~858 days

Total

4

Last Release

1889d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/53413269f9ef839022f59d939bc3e0217db52c5ae1d3756aef2b4eab3f38c4ac?d=identicon)[arcdigital](/maintainers/arcdigital)

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

---

Top Contributors

[![arcdigital](https://avatars.githubusercontent.com/u/551002?v=4)](https://github.com/arcdigital "arcdigital (16 commits)")[![abbert](https://avatars.githubusercontent.com/u/1160563?v=4)](https://github.com/abbert "abbert (2 commits)")[![nelson6e65](https://avatars.githubusercontent.com/u/9272498?v=4)](https://github.com/nelson6e65 "nelson6e65 (2 commits)")[![retlehs](https://avatars.githubusercontent.com/u/115911?v=4)](https://github.com/retlehs "retlehs (2 commits)")[![adilyildiz](https://avatars.githubusercontent.com/u/1780401?v=4)](https://github.com/adilyildiz "adilyildiz (1 commits)")[![ericnkatz](https://avatars.githubusercontent.com/u/91019?v=4)](https://github.com/ericnkatz "ericnkatz (1 commits)")

---

Tags

svgbackgroundpatterngeometric

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/redeyeventures-geopattern/health.svg)

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

###  Alternatives

[components/flag-icon-css

A curated collection of all country flags in SVG — plus the CSS for easier integration.

12.0k1.6M23](/packages/components-flag-icon-css)[twbs/bootstrap-icons

Official open source SVG icon library for Bootstrap

7.9k2.0M56](/packages/twbs-bootstrap-icons)[simple-icons/simple-icons

SVG icons for popular brands

24.8k194.2k4](/packages/simple-icons-simple-icons)[rinvex/countries

Rinvex Countries is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.

1.7k7.4M48](/packages/rinvex-countries)[league/pipeline

A plug and play pipeline implementation.

1.0k16.0M74](/packages/league-pipeline)[kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

1.1k4.5M5](/packages/kartik-v-bootstrap-star-rating)

PHPackages © 2026

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