Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/webdevcave/directory-crawler-php

Directory Crawler PHP is a simple PHP library for recursively crawling through directories and listing files and directories.
https://github.com/webdevcave/directory-crawler-php

crawler crawling directory path php php-library

Last synced: 7 days ago
JSON representation

Directory Crawler PHP is a simple PHP library for recursively crawling through directories and listing files and directories.

Awesome Lists containing this project

README

        

# Directory Crawler

![StyleCi](https://github.styleci.io/repos/817050761/shield)
[![Latest Stable Version](https://poser.pugx.org/webdevcave/directory-crawler/v/stable?format=flat-square)](https://packagist.org/packages/webdevcave/directory-crawler)
[![Latest Unstable Version](https://poser.pugx.org/webdevcave/directory-crawler/v/unstable?format=flat-square)](https://packagist.org/packages/webdevcave/directory-crawler)
[![Total Downloads](https://poser.pugx.org/webdevcave/directory-crawler/downloads?format=flat-square)](https://packagist.org/packages/webdevcave/directory-crawler)
[![License](https://poser.pugx.org/webdevcave/directory-crawler/license?format=flat-square)](https://packagist.org/packages/webdevcave/directory-crawler)

Directory Crawler PHP is a simple PHP library for recursively crawling through directories and listing files and
directories.

## Features

- Recursively crawls through a specified directory.
- Retrieves a list of files and directories within the specified directory.
- Retrieves a list of classes inside the repository (PSR4 structured repositories).

## Installation

You can install the package via Composer:

```bash
composer require webdevcave/directory-crawler-php
```

## Usage

```php
contents();

// Get all files
$files = $crawler->files();

// Get all directories
$directories = $crawler->directories();

// List classes inside the directories
$namespace = 'My\\Project\\';
$enforce = false; //Faster
//$enforce = true; //Reliable but slower. May cause performance issues, depending on the number of occurrences.
$classes = $crawler->classes($namespace, $enforce);

print_r(compact('path', 'contents', 'files', 'directories', 'classes')); //Show results
```

## Contributing

Contributions are welcome! Fork the repository, make your changes, and submit a pull request. Please ensure to write
tests for any new functionality or bug fixes.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.