There is multiple ways to go about this.
You could write a standalone PHP application that calls all the URLs on your site from an XML sitemap or an array of links and then downloads the rendered HTML using the file_get_contents()
function (see doc here).
Something along the lines of this (following code is untested):
// [filename] => [URL]
$pages = array(
'index.html' => 'https://example.com/',
'contact.html' => 'https://example.com/contact.html',
);
foreach($pages as $filename => $link){
$filePath = $_SERVER['DOCUMENT_ROOT'].'/'.$filename;
$html= file_get_contents($link);
$handle = fopen($filePath,"w");
fwrite($handle,$html);
fclose($handle);
}
Alternatively you could write a snippet within MODX and get the resource URLs directly using xPDO. The following code will get the links and file names for all resources and exclude weblinks, symlinks and static resources in the process. If you're planning on implementing the following code within your package, you will need to adjust it slightly.
$resources = $modx->getIterator('modResource', array(
'class_key' => 'modDocument',
));
$pages = array();
foreach($resources as $resource){
$pages[$resource->get('alias').'.html'] = $modx->makeUrl($resource->get('id'), '', '', 'full');
}
Output of the $pages
array in the above code would be as follows:
Array
(
[index.html] => https://example.com/
[test.html] => https://example.com/test.html
)