Download the PHP package atelier/pattern without Composer
On this page you can find all versions of the php package atelier/pattern. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package pattern
Repeatable SVG tiles for fills and strokes, in PHP.
Fill a surface with dots, stripes, grids, or geometric and seeded motifs. Each tile joins with itself so the pattern repeats across the surface.
Examples from the catalogue: staggered dots and seigaiha.
A pattern is an immutable value. It needs no document to exist and provides a <pattern>
element plus the url(#id) that references it. Add the tile to an Atelier SVG document and
use it as a fill or stroke. For drawings generated for one viewport, see atelier/field.
Documentation
Installation
Requires PHP 8.3+ and atelier/svg. Composer installs the package dependencies.
Quick start
The example has three steps:
- Create the tile with
Pattern::dots(). - Register it in the document with
PatternRegistry. - Fill the rectangle using
$dots->fill().
The registry places the tile in <defs>. Its identifier is derived from its geometry and style.
Style
Style methods return a new pattern, leaving the original unchanged. The following snippets reuse the imports and autoloader above.
The default paint is currentColor and the tile background is transparent. The colour inherits
from the pattern definition's ancestors in <defs>; setting color on the SVG root themes it.
A consuming shape's own color does not recolour that definition. For independent colours,
create patterns with different withColor() values and register each one.
Catalogue
|
Dots |
Stripes |
|
Crosshatch |
Grid |
|
Triangles |
Honeycomb |
|
Scales |
Herringbone |
|
Chevron |
Houndstooth |
|
Isometric cubes |
Asanoha |
|
Seigaiha |
Flower of life |
|
Checker |
Quatrefoil |
|
Greek key |
Truchet |
|
Jittered dots |
Rough hatch |
|
Staggered bricks |
Confetti |
|
Voronoi |
Mosaic |
Error handling
Invalid geometry or styling throws Atelier\Pattern\Exception\InvalidArgumentException.
All package exceptions implement Atelier\Pattern\Exception\ExceptionInterface.
Each tile documents its accepted ranges; see Getting started
for validation, identifiers, and seeded output guarantees.
Gallery
From a repository checkout with dependencies installed:
Writes examples/output/index.html with every tile rendered at 300 by 200.
Documentation
- Getting started: install the package and produce a first SVG.
- Illustrated catalogue: choose a tile and explore its parameters.
- Package overview: understand the API and its boundaries.
Read the complete guides and generated illustrations in docs/.
Contributing
Contributions are welcome. Visit the project on GitHub to report a bug, suggest a feature, or open a pull request.
Before submitting code, run:
Changes to public behaviour need tests and a documentation update. Keep line coverage at 100%. Coverage reporting requires PCOV or Xdebug.
Support
Bug reports, security disclosures, and contribution guidelines are collected at ateliersvg.com/support.
License
Atelier Pattern is released under the MIT License.