After pawing through the source, it looks like it can't be done yet.
However in app.xml there's a tag called "Pages" that should contain the number of pages. I don't think it's accurate, but it's at least something.
Here's some sample code:
// Include PHPWord and other stuff before here
function getPages() {
$zip = new \PhpOffice\PhpWord\Shared\ZipArchive();
$zip->open("/path/to/your/document.docx");
preg_match("/\<Pages>(.*)\<\/Pages\>/", $zip->getFromName("docProps/app.xml"), $var);
return $var[0];
}
This returns 1
for me on a document that should have 2 pages. It could be PHPWord not bothering to calculate the number of pages, or it counting page breaks only, but at least it's a start.
EDIT: Using the Word command line, I can update the page count programatically:
\path\to\winword.exe /mToolsWordCountRecount /mFileSave /mFileCloseOrExit myfile.docx
This adds a second or two to generation, but at least now I can accurately detect the number of pages