/** @var PageField $field */
$field = $fields->new('page', 'related_products', 'Related Products');
// Restrict selectable pages to a single template
$field->setTemplate('product');
// Or restrict to multiple templates
$field->setTemplates(['product', 'service']);
// Restrict selectable pages to children of a specific parent
$field->setParent('/products/');
// Set the Inputfield type used in the page editor
$field->setInputfield('checkboxes'); // InputfieldCheckboxes -- THIS LINE DOES NOT ACTUALLY WORK
// Return single page rather than PageArray
$field->set('derefAsPage', FieldtypePage::derefAsPageOrNullPage);
$fields->save($field);
Using the example in
/wire/modules/Fieldtype/FieldtypePage/API.md, checkboxes never actually gets set: