Download the PHP package robertbyrnes/dir2db without Composer
On this page you can find all versions of the php package robertbyrnes/dir2db. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download robertbyrnes/dir2db
More information about robertbyrnes/dir2db
Files in robertbyrnes/dir2db
Package dir2db
Short Description Uses PHP recursive iterator classes and regex iterator class to recursively search directories for .php files.
License GPL-3.0-or-later
Informations about the package dir2db
dir2db
dir2db
-
Uses PHP recursive iterator classes and regex iterator class to recursively search directories for .php files.
-
Any file extension may be searched for, or a group of them by passing in regex. See help description (run dir2db.php in cmd)
- Certain named directories may be excluded from the search, again by passing in regex through cmd (see help in dir2db.php)
Setup
Install via then cd into package root directory and run
Use dir2db.sql to install table to a mySQL database.
For example run
Edit ./private/local.ini to include correct database credentials.
Useage
In CMD/terminal type 'php dir2db.php', this will show the help menu:
Examples
php dir2db.php -p c:/wamp/www/repositoriesphp dir2db.php -p c:/wamp/www/repositories -r "/\.(?:txt)$/"php dir2db.php -p c:/wamp/www/repositories -r "/\.(?:txt)$/" -e vendor|node_modulesphp dir2db.php -p c:/wamp/www/repositories -r "/\.(?:txt|ini|sql)$/" -e vendor|node_modules
- Example 1 will search all directories within repositories for php files
- Example 2 will search for .txt file within repositories
- Example 3 as example 2, additionally excluding anything within directories named 'vendor' or 'node_modules'
- Example 4 demonstrates using the regex to include multiple file extensions
Memory Limit!
If you see a fatal exception - Allowed Memory Limit re-run your command explicity as shown below:
The will tell php to ignore the memory limit whilst executing this process.
A note on Binary file types
- The following binary file types are supported:
- 'pdf', 'jpg', 'jpeg', 'png', 'gif', 'svg', 'ico', 'bmp', 'tiff', 'tif', 'webp'
- file contents for these files will be stored in the
binary_file_contentdatabase column which is ofLONGBLOBtype. - Files not in this list are stored in the
file_contentcolumn which is ofLONGTEXTtype.FileFinder Trait
The FileFinder trait uses PHP's recursive iterator classes to search for files in a directory structure returning an array of results.
Usage
To use the FileFinder trait, call the fileFinder method with the following parameters:
$path- The path to the directory you want to search$fileFilter(optional) - A regex to find PHP file extensions$directoryFilter(optional) - Directory names to exclude from the search
The fileFinder method will then return an array of results.