1. Go to this page and download the library: Download xeeeveee/sudoku library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xeeeveee / sudoku example snippets
// Generate a new puzzle
$puzzle = new Xeeeveee\Sudoku\Puzzle();
$puzzle->generatePuzzle();
$puzzle = $puzzle->getPuzzle();
// Solve a pre-determined puzzle
$puzzle = new Xeeeveee\Sudoku\Puzzle($puzzle);
$puzzle->solve();
$solution = $puzzle->getSolution();
// Check a puzzle is solvable
$puzzle = new Xeeeveee\Sudoku\Puzzle();
$puzzle->setPuzzle($puzzle);
$solvable = $puzzle->isSolvable();
// Check a puzzle is solved
$puzzle = new Xeeeveee\Sudoku\Puzzle();
$puzzle->setPuzzle($puzzle);
$puzzle->solve($puzzle);
$solved = $puzzle->isSolved();
// Generate a puzzle with a different cell size
$puzzle = new Xeeeveee\Sudoku\Puzzle();
$puzzle->setCellSize(5); // 25 * 25 grid
$puzzle->generatePuzzle();
// Setting properties in the constructor
$puzzle = new Xeeeveee\Sudoku\Puzzle($cellSize, $puzzle, $solution);
$puzzle = new Xeeeveee\Sudoku\Puzzle();
$puzzle->generatePuzzle();
$puzzle = new Xeeeveee\Sudoku\Puzzle();
$puzzle->generatePuzzle(25);
$puzzle = new Xeeeveee\Sudoku\Puzzle();
$puzzle->generatePuzzle(25);
$puzzle->solve();