I would suggest you not to create one from scratch. As you can use ready made libraries.
For Ex : You can use Symfony's Finder Component in your project.
https://symfony.com/doc/current/components/finder.html
You just have to install it using composer. If you have not used composer yet, give it a try. https://getcomposer.org/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.