PHP Classes
elePHPant
Icontem

PHP Search String in File: Search for files with a given string using grep

Recommend this page to a friend!
  Info   View files Example   Demos   View files View files (58)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-07-18 (15 hours ago) RSS 2.0 feedStarStarStarStar 70%Total: 220 This week: 21All time: 7,797 This week: 35Up
Version License PHP version Categories
searchstringindirect 1.0.3The PHP License5PHP 5, Files and Folders, Searching, U...
Collaborate with this project Author
Description

This class can search for files with a given string using grep.

It can take a given string and performs a search using the grep command on files inside a given directory that may contain that string.

The grep command may take custom options, so it may perform searches on directories recursively.

Certain files specified in a class array variable may be ignored and not be returned in the results.

Innovation Award
PHP Programming Innovation award winner
August 2016
Winner


Prize: SourceGuarding PHP encoder tool
Searching for the contents of files in PHP is easy. However it can be slow when you need to search for data in many files.

This class provides an alternative that can be faster by using the grep command that is available in most Unix or Linux distributions, so it can search many files at once traversing directories recursively.

Manuel Lemos
  Performance   Level  
Name: Truong Van Phu <contact>
Classes: 2 packages by
Country: Viet Nam Viet Nam
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Details

SearchStringInDirectory

PHP Search String In Directory

Searching for the contents of files in PHP is easy. However it can be slow when you need to search for data in many files.

This class provides an alternative that can be faster by using the grep command that is available in most Unix or Linux distributions, so it can search many files at once traversing directories recursively.

How to use 1. Require class: require_once 'SearchStringInDirectory.php'; 2. Using: $srch = new SearchStringInDirectory('/path/to/search/folder'); 3. Using: $result $srch->search("Search string");

Example code in 'index.php' file.

Thank you !

Donations

I highly appreciate any of your donations.

paypal

  Demo Search String In DirectoryExternal page  

Open in a separate window

  Files folder image Files  
File Role Description
Files folder imagejquery-upload-file (11 files, 7 directories)
Plain text file index.php Example Example script
Plain text file README.md Doc. Documentation
Plain text file SearchStringInDirectory.php Class Class source

  Files folder image Files  /  jquery-upload-file  
File Role Description
Files folder imagecors (2 files)
Files folder imagecss (10 files)
Files folder imagefonts (1 file)
Files folder imageimg (2 files)
Files folder imagejs (18 files, 2 directories)
Files folder imageserver (1 directory)
Files folder imagetest (2 files)
  Plain text file .jshintrc Data Auxiliary data
  HTML file angularjs.html Doc. Documentation
  HTML file basic-plus.html Doc. Documentation
  HTML file basic.html Doc. Documentation
  Plain text file bower.json Data Auxiliary data
  Plain text file CONTRIBUTING.md Data Auxiliary data
  Plain text file Gruntfile.js Data Auxiliary data
  HTML file index.html Doc. Documentation
  HTML file jquery-ui.html Doc. Documentation
  Plain text file package.json Data Auxiliary data
  Plain text file README.md Doc. Documentation

  Files folder image Files  /  jquery-upload-file  /  cors  
File Role Description
  HTML file postmessage.html Doc. Documentation
  HTML file result.html Doc. Documentation

  Files folder image Files  /  jquery-upload-file  /  css  
File Role Description
  Plain text file blueimp-gallery.min.css Data Auxiliary data
  Plain text file bootstrap.min.css Data Auxiliary data
  Plain text file demo-ie8.css Data Auxiliary data
  Plain text file demo.css Data Auxiliary data
  Plain text file docs.css Data Auxiliary data
  Plain text file jquery.fileupload-noscript.css Data Auxiliary data
  Plain text file jquery.fileupload-ui-noscript.css Data Auxiliary data
  Plain text file jquery.fileupload-ui.css Data Auxiliary data
  Plain text file jquery.fileupload.css Data Auxiliary data
  Plain text file style.css Data Auxiliary data

  Files folder image Files  /  jquery-upload-file  /  fonts  
File Role Description
  Plain text file glyphicons-halflings-regular.svg Data Auxiliary data

  Files folder image Files  /  jquery-upload-file  /  img  
File Role Description
  Image file loading.gif Icon Icon image
  Image file progressbar.gif Icon Icon image

  Files folder image Files  /  jquery-upload-file  /  js  
File Role Description
Files folder imagecors (2 files)
Files folder imagevendor (1 file)
  Plain text file app.js Data Auxiliary data
  Plain text file bootstrap.min.js Data Auxiliary data
  Plain text file canvas-to-blob.min.js Data Auxiliary data
  Plain text file hilitor.js Data Auxiliary data
  Plain text file jquery.blueimp-gallery.min.js Data Auxiliary data
  Plain text file jquery.fileupload-angular.js Data Auxiliary data
  Plain text file jquery.fileupload-audio.js Data Auxiliary data
  Plain text file jquery.fileupload-image.js Data Auxiliary data
  Plain text file jquery.fileupload-jquery-ui.js Data Auxiliary data
  Plain text file jquery.fileupload-process.js Data Auxiliary data
  Plain text file jquery.fileupload-ui.js Data Auxiliary data
  Plain text file jquery.fileupload-validate.js Data Auxiliary data
  Plain text file jquery.fileupload-video.js Data Auxiliary data
  Plain text file jquery.fileupload.js Data Auxiliary data
  Plain text file jquery.iframe-transport.js Data Auxiliary data
  Plain text file jquery.js Data Auxiliary data
  Plain text file load-image.all.min.js Data Auxiliary data
  Plain text file main.js Data Auxiliary data

  Files folder image Files  /  jquery-upload-file  /  js  /  cors  
File Role Description
  Plain text file jquery.postmessage-transport.js Data Auxiliary data
  Plain text file jquery.xdr-transport.js Data Auxiliary data

  Files folder image Files  /  jquery-upload-file  /  js  /  vendor  
File Role Description
  Plain text file jquery.ui.widget.js Data Auxiliary data

  Files folder image Files  /  jquery-upload-file  /  server  
File Role Description
Files folder imagephp (5 files, 1 directory)

  Files folder image Files  /  jquery-upload-file  /  server  /  php  
File Role Description
Files folder imagefiles (1 file)
  Plain text file .htaccess Data Auxiliary data
  Plain text file docker-compose.yml Data Auxiliary data
  Plain text file Dockerfile Data Auxiliary data
  Plain text file index.php Example Example script
  Plain text file UploadHandler.php Class Class source

  Files folder image Files  /  jquery-upload-file  /  server  /  php  /  files  
File Role Description
  Plain text file .htaccess Data Auxiliary data

  Files folder image Files  /  jquery-upload-file  /  test  
File Role Description
  HTML file index.html Doc. Documentation
  Plain text file test.js Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:220
This week:21
All time:7,797
This week:35Up
 User Ratings  
 
 All time
Utility:87%StarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:87%StarStarStarStarStar
Examples:93%StarStarStarStarStar
Tests:-
Videos:-
Overall:70%StarStarStarStar
Rank:312