globでファイルのみを消去
array_map('unlink', glob("path/to/dir/*.php"));
イテレーターでファイルとディレクトリを消去
foreach (new RecursiveIteratorIterator(new \RecursiveDirectoryIterator('path/to/dir', \FilesystemIterator::SKIP_DOTS),RecursiveIteratorIterator::CHILD_FIRST) as $file) {
$file->isDir() ? rmdir($file->getPathname()) : unlink($file->getPathname());
}