Here is a simple tutorial to do the structure needed in the component of Ant Design TreeSelect (https://ant.design/components/tree-select/) with PHP. First of all, we would create the class Directory with a few attributes
I use Storage::directories from Laravel Facades, but also, you can use another implementation for list the directories given a path. In Laravel, this is maked with Finder Once you create both classes, you can initialize the Formatter with the path that you are interested to list and then call the method listDirectories().