PHPackages                             robiningelbrecht/twisty-puzzle-scrambler - 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. robiningelbrecht/twisty-puzzle-scrambler

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

robiningelbrecht/twisty-puzzle-scrambler
========================================

Generate, verify and analyse twisty puzzle scrambles

03PHP

Since Oct 11Pushed 2y ago1 watchersCompare

[ Source](https://github.com/robiningelbrecht/twisty-puzzle-scrambler)[ Packagist](https://packagist.org/packages/robiningelbrecht/twisty-puzzle-scrambler)[ RSS](/packages/robiningelbrecht-twisty-puzzle-scrambler/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Twisty puzzle scrambler
=======================

[](#twisty-puzzle-scrambler)

[![CI](https://github.com/robiningelbrecht/twisty-puzzle-scrambler/actions/workflows/ci.yml/badge.svg)](https://github.com/robiningelbrecht/twisty-puzzle-scrambler/blob/master/.github/workflows/ci.yml)[![License](https://camo.githubusercontent.com/3160edff3e1564038a94c20aaa96d9e051f5f3d60593a84d549a5ed80b273b1b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f726f62696e696e67656c6272656368742f7477697374792d70757a7a6c652d736372616d626c65723f636f6c6f723d343238663765266c6f676f3d6f70656e253230736f75726365253230696e6974696174697665266c6f676f436f6c6f723d7768697465)](https://github.com/robiningelbrecht/twisty-puzzle-scrambler/blob/master/LICENSE)[![](https://camo.githubusercontent.com/89a86c5d44d6fe58ab0eeec98855d93b3a106b8bc0a61159a67de8e1cb3f9dba/68747470733a2f2f636f6465636f762e696f2f67682f726f62696e696e67656c6272656368742f7477697374792d70757a7a6c652d736372616d626c65722f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d706a32554833584c4b41)](https://app.codecov.io/gh/robiningelbrecht/twisty-puzzle-scrambler)[![PHPStan Enabled](https://camo.githubusercontent.com/cb01a196883cd3d15842161f335945a81aff81c4c55d44b9f3b9a648ebf0f774/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d7375636365732e7376673f6c6f676f3d706870266c6f676f436f6c6f723d776869746526636f6c6f723d333143363532)](https://phpstan.org/)[![PHP](https://camo.githubusercontent.com/4cf6df1421f83aaf4240d035d38f57bfa65e5bb60b39ac636880e825c4938888/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f726f62696e696e67656c6272656368742f7477697374792d70757a7a6c652d736372616d626c65722f6465762d6d61737465723f636f6c6f723d253233373737626233266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://php.net/)

---

Tool to generate, verify and analyse scrambles for various twisty puzzles. This is not an official WCA scrambler but good enough for casual use.

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

[](#installation)

```
> composer require robiningelbrecht/twisty-puzzle-scrambler
```

Usage
-----

[](#usage)

### Standard cube

[](#standard-cube)

#### Generate random scramble

[](#generate-random-scramble)

The `RandomScramble` factory generates scrambles that are WCA compliant (in size).

```
// R F2 U' R' U2 F R' F2 R' U'
$scramble = RandomScramble::twoByTwo();
// R2 F' R2 D2 B R2 F' L2 U2 F' R2 F' U' F2 R D2 F L R U' L'
$scramble = RandomScramble::threeByThree();
// F2 L2 F' U2 L2 B2 D' R2 D' R2 U2 L2 R2 U2 R D' F2 L' D2 B' R Uw2 R' B2 Uw2...
$scramble = RandomScramble::fourByFour();
// R' Fw Uw Lw2 Dw U L2 B2 R2 Lw' L F2 Dw' B2 R Rw' L2 Bw' Uw2 D' U' L' Bw D...
$scramble = RandomScramble::fiveByFive();
// L D' B L2 3Fw' Fw' Uw2 U' R2 3Rw 3Uw Bw' 3Rw2 Rw' Uw2 3Uw2 3Rw' L2 Lw' D F2...
$scramble = RandomScramble::sixBySix();
// 3Bw2 3Rw' 3Dw Uw' 3Bw2 3Rw2 Lw' F B' D Lw' 3Bw' D2 Uw2 3Fw U2 3Lw' 3Dw' B Fw'...
$scramble = RandomScramble::sevenBySeven();
```

Or you can generate scrambles yourself

```
$scramble = CubeScramble::random($scrabmleSize, Size::fromInt($cubeSize))
```

#### Reverse scrambles

[](#reverse-scrambles)

```
$scramble = RandomScramble::threeByThree();
$reversedScramble = $scramble->reverse();
```

#### Output scramble as human-readable notation

[](#output-scramble-as-human-readable-notation)

```
$scramble = RandomScramble::threeByThree();
print_r($scramble->forHumans());
```

```
Turn the right layer 180°
Turn the bottom layer 90° clockwise
Turn the back layer 90° counterclockwise
Turn the bottom layer 180°
Turn the left layer 90° counterclockwise
Turn the back layer 90° counterclockwise
Turn the right layer 90° counterclockwise
Turn the back layer 180°
Turn the top layer 90° clockwise
Turn the right layer 180°
...

```

#### Validate and analyse a scramble

[](#validate-and-analyse-a-scramble)

```
$scramble = CubeScramble::fromNotation(
    "B D R2 U F2 U' R2 U' B2 L2 U2 L2 R2 B' F2 R' U L D' U R'",
    Size::fromInt($cubeSize)
);
```

At that point the scramble is `stringable` or `jsonSerializable`. When the scramble is invalid, a `InvalidScramble` exception will be thrown.

### Pyraminx

[](#pyraminx)

```
// U' B' L' R' U B U R' l' b u'
$scramble = RandomScramble::pyraminx();
$scramble = PyraminxScramble::random($scrabmleSize)
```

### Skewb

[](#skewb)

```
// B L' R L' B' U R' B' U'
$scramble = RandomScramble::skewb();
$scramble = SkewbScramble::random($scrabmleSize)
```

### Megaminx

[](#megaminx)

```
//  R++ D++ R-- D++ R++ D++ R++ D-- R++ D++ U R++ D-- R-- D-- R-- D++ R++ D-- R++ D++ U...
$scramble = RandomScramble::megaminx();
$scramble = MegaminxScramble::random($scrabmleSize, $numberOfSequences)
```

### Clock

[](#clock)

```
// UR1+ DR3- DL0+ UL6+ U4- R6+ D1- L6+ ALL2+ y2 U1+ R3+ D1- L4+ ALL3- DR DL UL
$scramble = RandomScramble::clock();
$scramble = CockScramble::random()
```

### Sq1

[](#sq1)

```
//  (4,0)/ (0,3)/ (3,0)/ (-3,0)/ (2,-1)/ (4,-3)/ (0,-3)/ (0,-2)/ (3,-1)/ (2,-1)/ (3,0)/ (-2,0)/ (3,0)/ (0,-5)
$scramble = RandomScramble::sq1();
$scramble = Sq1Scramble::random($scrabmleSize)
```

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c460d3d078ca95a2f552ae1eb15d4fb916781d264149a1d5ca503fe69967b91?d=identicon)[robiningelbrecht](/maintainers/robiningelbrecht)

---

Top Contributors

[![robiningelbrecht](https://avatars.githubusercontent.com/u/203894?v=4)](https://github.com/robiningelbrecht "robiningelbrecht (52 commits)")

---

Tags

php8rubiks-cubescrambletwisty-puzzles

### Embed Badge

![Health badge](/badges/robiningelbrecht-twisty-puzzle-scrambler/health.svg)

```
[![Health](https://phpackages.com/badges/robiningelbrecht-twisty-puzzle-scrambler/health.svg)](https://phpackages.com/packages/robiningelbrecht-twisty-puzzle-scrambler)
```

###  Alternatives

[ergebnis/clock

Provides abstractions of a clock.

301.2M](/packages/ergebnis-clock)[bandwidth-throttle/bandwidth-throttle

Bandwidth throttle at application layer

87139.3k](/packages/bandwidth-throttle-bandwidth-throttle)

PHPackages © 2026

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