PHP code example of chipulaja / algo-sudoku-generator

1. Go to this page and download the library: Download chipulaja/algo-sudoku-generator 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/ */

    

chipulaja / algo-sudoku-generator example snippets


use Chipulaja\Algo\Sudoku\Generator;
use Chipulaja\Algo\Sudoku\GeneratorHelper;

$generator = new Generator();
$data = $generator->generate();

$helper = new GeneratorHelper();
echo $helper->getBoard($data);

/*
  -----------------------
 | 8 2 9 | 4 3 5 | 7 6 1 | 
 | 5 7 4 | 6 1 8 | 3 2 9 | 
 | 1 3 6 | 2 9 7 | 4 8 5 | 
  -----------------------
 | 3 1 8 | 5 7 6 | 2 9 4 | 
 | 4 9 2 | 1 8 3 | 6 5 7 | 
 | 7 6 5 | 9 4 2 | 1 3 8 | 
  -----------------------
 | 9 4 3 | 8 2 1 | 5 7 6 | 
 | 2 5 1 | 7 6 9 | 8 4 3 | 
 | 6 8 7 | 3 5 4 | 9 1 2 | 
  -----------------------

*/