How to replace file_get_contents() with a WordPress Filesystem call

Firstly add this two line to your functions.php file. Sorry I forgot to mention about this earlier.

require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php';
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php';

now you can use WP_Filesystem_Direct::get_contents($path) instead of file_get_contents($path)