Feature: walker function: walker(".") returns an object model of the entire directory / an expansive alternative for scandir()
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
Here is my current code for demonstrating the purpose. The dev community shall decide on the final verdict.
<?php
function walker($directory) {
foreach (scandir($directory) as $item) {
if ($item == '.' || $item == '..') continue;
if ($directory == "." && ($item == "api.php" || $item == 'index.html')) continue;
$dl[$item] = [
"item_type" => is_dir("{$directory}/{$item}") ? "folder" : "file",
"child" => walker("{$directory}/{$item}"),
];
}
return $dl;
}
?>
Here's how I'm currently using it :) with some html css and js
How it looks like when I use echo and json_encode.
I'll be making a pull request if it got a lot of good impressions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposed walker($directory) example and its intended object model for recursive directory traversal. Compare the request with the existing scandir() behavior and determine whether a concrete PHP API, scope, and completion criteria can be defined; the issue currently names no source files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100