serves($sitePath, $siteName, $driver->mutateUri($uri))) { return $driver; } } } /** * Get all of the driver classes in a given path. * * @param string $path * @return array */ public static function driversIn($path) { if (! is_dir($path)) { return []; } $drivers = []; foreach (scandir($path) as $file) { if ($file !== 'ValetDriver.php' && strpos($file, 'ValetDriver') !== false) { require_once $path.'/'.$file; $drivers[] = basename($file, '.php'); } } return $drivers; } /** * Mutate the incoming URI. * * @param string $uri * @return string */ public function mutateUri($uri) { return $uri; } /** * Serve the static file at the given path. * * @param string $staticFilePath * @param string $sitePath * @param string $siteName * @param string $uri * @return void */ public function serveStaticFile($staticFilePath, $sitePath, $siteName, $uri) { $extension = pathinfo($staticFilePath)['extension']; $mimes = require(__DIR__.'/../mimes.php'); $mime = isset($mimes[$extension]) ? $mimes[$extension] : 'application/octet-stream'; header('Content-Type: '. $mime); readfile($staticFilePath); } }