1. Go to this page and download the library: Download vgip/wordle 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/ */
vgip / wordle example snippets
use Vgip\Wordle\Pick\Pick;
use Vgip\Wordle\Pick\LetterConfigFactory;
/** Get directory of words as array - see example/words_en_5_letter.txt for example */
$pathWords = join(DIRECTORY_SEPARATOR, [__DIR__, 'words_en_5_letter.txt']);
$wordList = file($pathWords);
/** Set conditions to pick of words */
$letterList = [];
$letterList['x'] = false; // The letter "x" is missing from a word.
$letterList['a'] = LetterConfigFactory::factory('defined', [2]); // Set that the letter "a" is in the word in 2nd place
$letterList['n'] = LetterConfigFactory::factory('undefined', [3, 5]); // Set that the letter "n" is not in the word in 3nd and 5nd places
$pick = new Pick();
$candidateList = $pick->getCandidate($wordList, $letterList);
$resultLog = $pick->getResultLog();
print_r($candidateList);