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

Abandoned → [redeyeventures/geopattern](/?search=redeyeventures%2Fgeopattern)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

mauris/geopattern
=================

Generate beautiful SVG patterns.

1.0.3(12y ago)218MITPHP

Since Apr 18Pushed 11y ago1 watchersCompare

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

READMEChangelog (2)DependenciesVersions (5)Used By (0)

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

[](#geopattern-)

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)

Add this line to the require section of your composer.json file:

```
"redeyeventures/geopattern": "1.2.*"

```

And then run:

```
$ composer install

```

Usage
-----

[](#usage)

Make a new pattern:

```
$geopattern = new GeoPattern\GeoPattern();
$geopattern->setString('Make me a SVGandiwch now.');

```

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 casted as a string, it will provide the SVG string result.

Laravel 4.x
-----------

[](#laravel-4x)

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

[](#contributing)

GeoPattern provides support for Laravel usage.

Add `'GeoPattern\ServiceProvider',` to the list of `providers` in the `app/config/app.php` configuration file.

Add `'GeoPattern'      => 'GeoPattern\Facades\GeoPattern',` in the list of `aliases` in the `app/config/app.php` configuration file.

You will then be able to use GeoPattern like this:

```
GeoPattern::setString('Make me a SVGandiwch now.');
GeoPattern::setBaseColor('#FFCC00');

$response = Response::make(GeoPattern::toSVG(), 200);
$response->header(
    'content-type',
    'image/svg+xml'
);
return $response;
```

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

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 64% 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 ~0 days

Total

4

Last Release

4404d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1743cee8bb3242229368d7fca5a7ac952932fd377d0c3d4343eb8dceea6a395e?d=identicon)[mauris](/maintainers/mauris)

---

Top Contributors

[![mauris](https://avatars.githubusercontent.com/u/996939?v=4)](https://github.com/mauris "mauris (32 commits)")[![arcdigital](https://avatars.githubusercontent.com/u/551002?v=4)](https://github.com/arcdigital "arcdigital (13 commits)")[![abbert](https://avatars.githubusercontent.com/u/1160563?v=4)](https://github.com/abbert "abbert (2 commits)")[![retlehs](https://avatars.githubusercontent.com/u/115911?v=4)](https://github.com/retlehs "retlehs (2 commits)")[![ericnkatz](https://avatars.githubusercontent.com/u/91019?v=4)](https://github.com/ericnkatz "ericnkatz (1 commits)")

---

Tags

svgbackgroundpatterngeometric

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/mauris-geopattern/health.svg)](https://phpackages.com/packages/mauris-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)[redeyeventures/geopattern

Generate beautiful SVG patterns.

11140.8k2](/packages/redeyeventures-geopattern)[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)

PHPackages © 2026

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