takuya / php-plocate-wrapper
plocate search wrapper
0.3.3
2025-03-04 15:28 UTC
Requires
- takuya/php-proc_open-wrapper: ^0.4.0
- takuya/php-stringio: ^0.1.0
Requires (Dev)
- larapack/dd: ^1.1
- phpunit/phpunit: ^9.6
README
php wrapper for plocate and plocate-build command for search files
find files by plocate db
search files using locate.db(plocate database)
<?php $locate = new LocateWrap(); $ret = $locate->search('composer.json'); foreach ($ret as $item) { var_dump($item); }
find files from sub-directory ( not from / )
We can find files from only sub-directory by shell.
## build file database only ~/Documents subdir=/home/takuya/Documemts cd $subdir find . -type f -printf '%P\n' > find-results.txt plocate-build -p find-results.txt my-document.db ## find from using custom database plocate -d my-document.db .docx
This project is aimed to build that database. sample code is below.
<?php $builder = new LocateDbBuilder('~/.Document.db','~/Document'); $builder->build(); $locate = new LocateWrap('~/.Document.db'); $found = $locate->search('.docx');
Installing
from GitHub.
name='php-plocate-wrapper' composer config repositories.$name \ vcs https://github.com/takuya/$name composer require takuya/$name:master composer install
from packagist
composer require takuya/php-plocate-wrapper