PHPackages                             bjoernffm/spintax - 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. bjoernffm/spintax

ActiveLibrary

bjoernffm/spintax
=================

Spintax {parsing|processing} library.

v1.1.0(1y ago)1238.6k—10%4[1 PRs](https://github.com/bjoernffm/spintax/pulls)MITPHPPHP &gt;=7.2CI failing

Since Jul 18Pushed 1y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (1)Versions (9)Used By (0)

Spintax
=======

[](#spintax)

[![GitHub](https://camo.githubusercontent.com/7f458303b5f4c2f8c7de66361bac0a5538c5cbd32321e4468bfa0c0ff949eed8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f626a6f65726e66666d2f7370696e746178)](https://camo.githubusercontent.com/7f458303b5f4c2f8c7de66361bac0a5538c5cbd32321e4468bfa0c0ff949eed8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f626a6f65726e66666d2f7370696e746178)[![GitHub release (latest by date)](https://camo.githubusercontent.com/6781a2bc2fb582e268ba4ad3913fa0cd819922ebac06466e588b906f505e62dc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f626a6f65726e66666d2f7370696e746178)](https://camo.githubusercontent.com/6781a2bc2fb582e268ba4ad3913fa0cd819922ebac06466e588b906f505e62dc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f626a6f65726e66666d2f7370696e746178)[![GitHub top language](https://camo.githubusercontent.com/8cef4a406c1681db03b04f60cc14b7fd8c3f255af07a05f4da0727131a5ca1bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f626a6f65726e66666d2f7370696e746178)](https://camo.githubusercontent.com/8cef4a406c1681db03b04f60cc14b7fd8c3f255af07a05f4da0727131a5ca1bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f626a6f65726e66666d2f7370696e746178)[![PHP Composer](https://github.com/bjoernffm/spintax/actions/workflows/php.yml/badge.svg)](https://github.com/bjoernffm/spintax/actions/workflows/php.yml)[![Codacy Badge](https://camo.githubusercontent.com/2a5253c98f411663ff1e27e1e167d3f7620a41f5f1c7f48a0aceaabb179a7163/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6438636366653065326365303430316261333731303935363234343631663734)](https://app.codacy.com/gh/bjoernffm/spintax/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)[![StyleCI](https://camo.githubusercontent.com/24c3a7d0c61b531a2c6343e718bcb491778b8e201a64616dcfe42f222f30cd8c/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3139373534333739322f736869656c643f6272616e63683d6d6173746572267374796c653d666c6174)](https://github.styleci.io/repos/197543792)

**Spintax** is a library which offers implementation of some commonly used patterns used in **Symfony2** DI.

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

[](#installation)

This library is provided as [Composer package](https://packagist.org/packages/bjoernffm/spintax). To install it simply execute the following command:

```
composer require bjoernffm/spintax

```

**Note:** This library requires **PHP 7.2+**.

Usage
-----

[](#usage)

The simplest usage that will mostly fulfill your needs is to simple parse the spintax string and generate random variation of it:

```
use bjoernffm\Spintax\Parser;

$spintax = Parser::parse('Schrödinger’s Cat is {dead|alive}.');
$string = $spintax->generate();
```

But there is much more that than that in our library. First of all nested structures are supported:

```
use bjoernffm\Spintax\Parser;

$spintax = Parser::parse('I {love {PHP|Java|C|C++|JavaScript|Python}|hate Ruby}.');
$string = $spintax->generate();
```

Still not finished! With our brilliant library you can detect the path used to generate given variant and re-use it later:

```
use bjoernffm\Spintax\Parser;

$path = [];

$spintax = Parser::parse('I {love {PHP|Java|C|C++|JavaScript|Python}|hate Ruby}.');
// since $path is empty, random values will be used for missing indices and $path will be filled with them
$string = $spintax->generate($path);

// from now you can use $path to re-create the same combination
// all these calls will keep returning same string value
$spintax->generate($path);
$spintax->generate($path);
$spintax->generate($path);
$spintax->generate($path);

// this will force generating "I love Java."
$path = [0, 1];
$spintax->generate($path);
```

Paths are counted from 0, each entry is next step.

You can also use partial paths to define just the starting path and all missing parts will be choosen randomly:

```
use bjoernffm\Spintax\Parser;

$path = [0];

$spintax = Parser::parse('I {love {PHP|Java|C|C++|JavaScript|Python}|hate Ruby}.');
// this will generate one of "I love {}." variants
$string = $spintax->generate($path);
```

For all this there is a shortcut method `Parser::replicate()` (you can use comma-separated number in a single string as second argument in this shortcut method):

```
use bjoernffm\Spintax\Parser;

echo Parser::replicate('I {love {PHP|Java|C|C++|JavaScript|Python}|hate Ruby}.', '0,0');
```

For more advanced aspects see [advanced usage documentation](https://github.com/chilloutdevelopment/ChillDevSpintax/tree/master/Resources/doc/usage.md) or even [internals description](https://github.com/chilloutdevelopment/ChillDevSpintax/tree/master/Resources/doc/internals.md).

Resources
---------

[](#resources)

- [Source documentation](https://github.com/bjoernffm/spintax/blob/master/Resources/doc/index.md)
- [GitHub page with API documentation](https://github.com/bjoernffm/spintax)
- [Issues tracker](https://github.com/bjoernffm/spintax/issues)
- [Packagist package](https://packagist.org/packages/bjoernffm/spintax)
- [Development @ GitHub](https://github.com/bjoernffm)

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

[](#contributing)

Do you want to help improving this project? Simply *fork* it and post a pull request. You can do everything on your own, you don't need to ask if you can, just do all the awesome things you want!

This project is published under [MIT license](https://github.com/bjoernffm/spintax/blob/master/LICENSE).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.3% 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 ~299 days

Recently: every ~402 days

Total

7

Last Release

701d ago

Major Versions

v0.1.2 → v1.0.02021-03-02

PHP version history (3 changes)v0.1.0PHP &gt;=5.4

v0.1.2PHP &gt;=7.2

v1.0.0PHP &gt;=7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3476587?v=4)[Björn Ebbrecht](/maintainers/bjoernffm)[@bjoernffm](https://github.com/bjoernffm)

---

Top Contributors

[![bjoernffm](https://avatars.githubusercontent.com/u/3476587?v=4)](https://github.com/bjoernffm "bjoernffm (26 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

seospintaxcontent generator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bjoernffm-spintax/health.svg)

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

###  Alternatives

[artesaos/seotools

SEO Tools for Laravel and Lumen

3.3k5.1M60](/packages/artesaos-seotools)[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6737.4M62](/packages/jbroadway-urlify)[nette/application

🏆 Nette Application: a full-stack component-based MVC kernel for PHP that helps you write powerful and modern web applications. Write less, have cleaner code and your work will bring you joy.

44615.4M983](/packages/nette-application)[butschster/meta-tags

The most powerful and extendable tools for managing SEO Meta Tags in your Laravel project

628730.7k2](/packages/butschster-meta-tags)[spatie/laravel-robots-middleware

Add an `all` or `none` robots header to your requests via a middleware in Laravel

3352.1M5](/packages/spatie-laravel-robots-middleware)[sonata-project/seo-bundle

Symfony SonataSeoBundle

1442.7M41](/packages/sonata-project-seo-bundle)

PHPackages © 2026

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