Supported Versions: PHP 5, PHP 7, PHP 8
List files and directories inside the specified path
<?php scandir(string $directory, int $sorting_order = SCANDIR_SORT_ASCENDING, ?resource $context = null): array|false
<?php 'laravel/sanctum:^4.0',
]);
$migrationPublished = collect(scandir($this->laravel->databasePath('migrations')))->contains(function ($migration) {
return preg_match('/\d{4}_\d{2}_\d{2}_\d{6}_create_personal_access_tokens_table.php/', $migration);
});
<?php $deleteDirectory = function (string $path) use (&$deleteDirectory): void {
if (file_exists($path)) {
$scannedDir = scandir($path);
assert(is_array($scannedDir));
$files = array_diff($scannedDir, ['.', '..']);
<?php return;
}
foreach ((array) scandir($dir) as $file) {
if ('.' === $file || '..' === $file) {
continue;
}
<?php $tmp = tmpfile();
$dir = @scandir('/dev/fd');
if ($dir === false) {
throw new \BadMethodCallException('Not supported on your platform because /dev/fd is not readable');
}
<?php $dir = __DIR__.'/../.peck.cache';
if (is_dir($dir)) {
$files = scandir($dir);
foreach ($files as $file) {
if ($file === '.') {
<?php $dir = __DIR__.'/../../.peck-test.cache';
if (is_dir($dir)) {
foreach (array_diff(scandir($dir), ['.', '..']) as $file) {
unlink("{$dir}/{$file}");
}
<?php $dir = __DIR__.'/../../.peck-test.cache';
if (is_dir($dir)) {
foreach (array_diff(scandir($dir), ['.', '..']) as $file) {
unlink("{$dir}/{$file}");
}