Sudoxu is a simple, headless sudoku grid generator library for PHP.

Maintainers

Package info

github.com/ikidnapmyself/sudoxu

pkg:composer/ikidnapmyself/sudoxu

Transparency log

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 4

Open Issues: 0

v1.1 2026-07-20 20:25 UTC

This package is auto-updated.

Last update: 2026-07-26 09:40:35 UTC


README

CI Latest Version PHP Version License

A simple, headless sudoku grid generator for PHP. It produces a fully-solved grid of a configurable (perfect-square) size, returned as an array, JSON, or a serialized string.

Requirements

  • PHP 8.1+

Installation

composer require ikidnapmyself/sudoxu

Usage

use Sudoxu\Sudoku;

$sudoku = new Sudoku();          // default 9x9

$json  = $sudoku->generate('json');       // JSON string
$array = $sudoku->generate('array');      // array
$ser   = $sudoku->generate('serialize');  // serialized string

Each call returns the grid plus metadata:

[
    'sudoku' => [ /* flat array, index = row * size + col */ ],
    'limit'  => 9,
    'result' => ['created_in' => 0.02, 'timestamp' => 1721480000, 'difficulty' => 'N/A'],
]

Other sizes

The size must be a perfect square between 1 and 36 (4, 9, 16, 25, 36):

$mini = (new Sudoku(4))->generate('array');

// or change size on an existing instance
$big  = (new Sudoku())->set(16)->generate('array');

An unsupported size throws an InvalidArgumentException.

Note: Larger grids (16x16 and up) are CPU- and memory-heavy. Unlike older versions, the library no longer changes memory_limit or the time limit for you — raise them in your own application if a large grid needs it.

Companion project

sudoxu-app — a front end built on top of this library.

License

MIT