PHPackages                             involix/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. involix/spintax

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

involix/spintax
===============

Spintax {parsing|processing} library.

v0.1.3(6y ago)023MITPHPPHP &gt;=7.1

Since Jul 18Pushed 6y agoCompare

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

READMEChangelog (1)Dependencies (1)Versions (5)Used By (0)

Spintax
=======

[](#spintax)

[![GitHub](https://camo.githubusercontent.com/a8a526efe7ed05f9a283e42cef3cc8f9d554e7bee4836ffac4393733fed82288/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f626a6f65726e66666d2f737465702d66756e6374696f6e73)](https://camo.githubusercontent.com/a8a526efe7ed05f9a283e42cef3cc8f9d554e7bee4836ffac4393733fed82288/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f626a6f65726e66666d2f737465702d66756e6374696f6e73)[![GitHub release (latest by date)](https://camo.githubusercontent.com/8472af3964dafa3ae3459c9cc9094b42165592cecb4b8537c51d1dd55e86f424/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f626a6f65726e66666d2f737465702d66756e6374696f6e73)](https://camo.githubusercontent.com/8472af3964dafa3ae3459c9cc9094b42165592cecb4b8537c51d1dd55e86f424/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f626a6f65726e66666d2f737465702d66756e6374696f6e73)[![GitHub top language](https://camo.githubusercontent.com/4643327b4a6e5f5eea718410f8e1b5dbbca954dad32be181f85a931e10075e58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f626a6f65726e66666d2f737465702d66756e6374696f6e73)](https://camo.githubusercontent.com/4643327b4a6e5f5eea718410f8e1b5dbbca954dad32be181f85a931e10075e58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f626a6f65726e66666d2f737465702d66756e6374696f6e73)[![Build Status](https://camo.githubusercontent.com/0ad4fc72a16c66d387b0db4f5c765ea75e99727b4e74a46c9081ba3489a94bdb/68747470733a2f2f7472617669732d63692e6f72672f626a6f65726e66666d2f7370696e7461782e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bjoernffm/spintax)[![Codacy Badge](https://camo.githubusercontent.com/2d8b2010d505506c9b24ce50260f48b40c1c131877528bd159e71c9f48ca60a9/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6438636366653065326365303430316261333731303935363234343631663734)](https://www.codacy.com/manual/bjoernffm/spintax)[![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

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.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

Total

4

Last Release

2190d ago

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

v0.1.2PHP &gt;=7.2

v0.1.3PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/75191f939aee64e753855a3601c2180ba3d8242fe06139929e1a431c67fd2cda?d=identicon)[eugenecooper](/maintainers/eugenecooper)

---

Top Contributors

[![bjoernffm](https://avatars.githubusercontent.com/u/3476587?v=4)](https://github.com/bjoernffm "bjoernffm (13 commits)")[![eugenecooper](https://avatars.githubusercontent.com/u/8261869?v=4)](https://github.com/eugenecooper "eugenecooper (1 commits)")

---

Tags

seospintaxcontent generatorchilldev

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

Spintax {parsing|processing} library.

162.4k](/packages/chilldev-spintax)[sonata-project/seo-bundle

Symfony SonataSeoBundle

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

PHPackages © 2026

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