I want include PHP file in drupal 8 module. What is the best way for it ?
Outside of autoloading, the only option Drupal provides itself is
module_load_include(), which literally
Loads a module include file.
// Load node.admin.inc from the node module. module_load_include('inc', 'node', 'node.admin'); // Load content_types.inc from the node module. module_load_include('inc', 'node', 'content_types');
The final part of the description is worth taking in separately as it's important:
Do not use this function to load an install file, use module_load_install() instead. Do not use this function in a global context since it requires Drupal to be fully bootstrapped, use require_once DRUPAL_ROOT . '/path/file' instead.
It's also worth noting this function won't be around forever, the plan is to move it completely into the module handler service.