Supported Versions: PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8
Returns information about a file path
<?php pathinfo(string $path, int $flags = PATHINFO_ALL): array|string
<?php     protected function fileIsServable(string $publicPath, string $pathToFile): bool

    {

        return $pathToFile &&

               ! in_array(pathinfo($pathToFile, PATHINFO_EXTENSION), ['php', 'htaccess', 'config']) &&

               str_starts_with($pathToFile, $publicPath) &&

               is_file($pathToFile);

    }
<?php         $publicPath = $context->publicPath;



        $swooleResponse->status(200);

        $swooleResponse->header('Content-Type', MimeType::get(pathinfo($request->path(), PATHINFO_EXTENSION)));

        $swooleResponse->sendfile(realpath($publicPath.'/'.$request->path()));

    }