use Illuminate\Filesystem\Filesystem; $fs = new Filesystem(); // Require the file at the given path $result = $fs->getRequire('/path/to/file.php'); // Check if the file was included successfully if ($result !== false) { // Do something with the file's value }
use Illuminate\Support\Facades\File; // Require the file at the given path using the facade $result = File::getRequire('/path/to/file.php'); // Check if the file was included successfully if ($result !== false) { // Do something with the file's value }This method is part of the Illuminate Filesystem package library, which is included in the Laravel framework. The package provides a unified and intuitive API for interacting with files and directories across different filesystems, including local, S3, FTP, and more.