Jason Lamb .ME Some stuff I think is cool and interesting, you might too!

October 8, 2026

One PHP Directory Browser, Many Folders

Filed under Technology

A directory listing is convenient until every folder has its own slightly different copy of the same viewer. My Custom Directory Browser centralizes that work in one renderer.

Each folder can use a small wrapper that loads the shared PHP file. The wrapper gives the renderer the local context, while the main implementation controls how the listing looks and behaves. An improvement to the shared view can then reach multiple directories without editing each copy.

The browser supports subdirectories, upward navigation, downloads, and favorites. Favorites are stored by full relative path rather than just a filename. That matters when several folders contain a file named notes.txt; the name alone does not identify the same item.

Sorting puts folders and useful entries in a predictable order, and the layout is intended to remain usable on a phone. The project also normalizes and sorts saved favorites so the stored data stays consistent.

Path handling is part of the implementation, not just presentation. The documented browser resolves paths and restricts navigation to its allowed root. Those boundaries deserve care because a useful file listing should show the intended directory tree, not whatever a crafted path happens to request.

The project runs on PHP without a required database, with a writable location for favorite data. A visible revision and modification timestamp help identify the shared renderer in use.

The main idea is simple reuse: put the common behavior in one place and let each folder supply the context. It is a small example of the same maintenance problem that shows up in much larger applications.

Explore the project on GitHub