PHP Classes
elePHPant
Icontem

Redbox PHP Scandir Filter: Scan files for new or modified files

Recommend this page to a friend!
  Info   View files Example   View files View files (36)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2016-02-23 (8 months ago) RSS 2.0 feedNot enough user ratingsTotal: 230 All time: 7,576 This week: 1,099Up
Version License PHP version Categories
redbox-scan 1.2MIT/X Consortium ...5.3PHP 5, Databases, Files and Folders, S...
Description Author

This package can scan files for new or modified files.

It can traverse a directory to retrieve the list of files and their modification dates.

It provides adapter classes to traverse either a local file system or a remote FTP server.

The class scan the directory again and extract reports of new and modified files.

The package comes with a report adapter that tracks changes in a MySQL database table accessed using MySQLi.

Innovation Award
PHP Programming Innovation award nominee
January 2016
Number 3


Prize: PhpStorm IDE personal permanent license
One way to detect if a site security was compromised is to detect changes in the files of the site.

This class can detect changes in the files of a remote site by accessing the files via FTP.

Manuel Lemos
Picture of Johnny Mast
  Performance   Level  
Name: Johnny Mast <contact>
Classes: 7 packages by
Country: The Netherlands The Netherlands
Innovation award
Innovation award
Nominee: 3x

Details

Build Status Scrutinizer Code Quality Code Coverage GitHub stars Twitter URL

Redbox-scan

Redbox-scan is a filesystem scanning and analyzing tool that allows you to scan your filesystem for new and modified files. The API is flexible and easy to use even for beginning developers. If you combine Redbox-scan with Redbox-cli you could build a powerful CLI (Commandline Interface) application to secure your servers within even minutes. An other use case for the API could be a trigger for rsyncing files to a new location.

Examples

In the examples folder you find basic examples of how to scan your filesystem. If you want to learn howto write your own Adapter i suggest checking out the database example.

Installation

Using composer:

$ composer require redbox/scan

Installation trough archive download

If you download the package from a website (for example github.io or phpclasses.org or any other) you will need composer installed on your machine. The reason for this is that Redbox-scan comes without the require vendor directory which is required to run the package.

First of all if you don't have composer installed you can find it here follow the instructions and don't get intimidated in fact its really really easy to install.

In the this sample i will assume you have composer installed (on any machine). Go to the package root (where composer.json is located) and execute the following command.

$ composer install  --no-dev

Now your almost ready to go. In your project require the redbox-scan.php (located in the package root). Assuming that Redbox-scan was installed in ./lib/redbox-scan/ your php file would look like this.

<?php
require 'lib/redbox-scan/redbox-scan.php';
// more of your nice code below

And you are ready use Redbox-scan in your application.

Unit Testing

Redbox-scan comes with a large suite of tests that you can run. The packages has 2 test suites you can run its the normal phpunit default test including tests for the FTPAdapter and there is the travis test suite that excludes the FTPAdapter tests. As the travis test suite implies this package has automated builds on trevis-ci.com to make sure the package is stable with every commit. Do not download any code from any branch that has a build failed status because it will not work for you.

Requirements

The following versions of PHP are supported by this version.

  • PHP 5.3
  • PHP 5.4
  • PHP 5.5
  • PHP 5.6
  • PHP 7
  • HHVM
  • Symfony Yaml 2.8

Development Requirements

  • Phpunit 4.8

Author

This package is created and maintained by Johnny Mast. If you have any questions feel free to contact me on twitter by using @mastjohnny in your tweet.

License

Redbox-scan is released under the MIT public license.

LICENSE

Enjoy

Oh and if you've come down this far, you might as well follow me on twitter.

  Files folder image Files  
File Role Description
Files folder imageexamples (4 files, 1 directory)
Files folder imagesrc (1 file, 4 directories)
Files folder imagetests (8 files, 1 directory)
Accessible without login Plain text file .gitignore Data Auxiliary data
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Data Auxiliary data
Plain text file redbox-scan.php Class Import this into your projects

  Files folder image Files  /  examples  
File Role Description
Files folder imageassets (3 files)
  Accessible without login Plain text file autoload.php Example Example script
  Accessible without login Plain text file basic.php Example Example script
  Accessible without login Plain text file database.php Example Example script
  Accessible without login Plain text file ftp.php Example Example script

  Files folder image Files  /  examples  /  assets  
File Role Description
  Accessible without login Plain text file index.html Data Documentation
  Accessible without login Plain text file scan.sql Data Auxiliary data
  Accessible without login Plain text file time.txt Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageAdapter (3 files)
Files folder imageException (1 file)
Files folder imageFilesystem (1 file)
Files folder imageReport (2 files)
  Plain text file ScanService.php Class Class source

  Files folder image Files  /  src  /  Adapter  
File Role Description
  Plain text file AdapterInterface.php Class Class source
  Plain text file Filesystem.php Class Class source
  Plain text file Ftp.php Class Class source

  Files folder image Files  /  src  /  Exception  
File Role Description
  Plain text file RuntimeException.php Class Class source

  Files folder image Files  /  src  /  Filesystem  
File Role Description
  Plain text file FileInfo.php Class Class source

  Files folder image Files  /  src  /  Report  
File Role Description
  Plain text file AbstractReport.php Class Class source
  Plain text file Report.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imageAssets (4 directories)
  Accessible without login Plain text file AbstractReportTest.php Test Unit test script
  Accessible without login Plain text file bootstrap.php Conf. Configuration script
  Accessible without login Plain text file FileInfoTest.php Test Unit test script
  Accessible without login Plain text file FilesystemAdapterTest.php Test Unit test script
  Accessible without login Plain text file FtpAdapterMiscTest.php Test Unit test script
  Accessible without login Plain text file FtpAdapterTest.php Test Unit test script
  Accessible without login Plain text file ReportTest.php Test Unit test script
  Accessible without login Plain text file ScanServiceTest.php Test Unit test script

  Files folder image Files  /  tests  /  Assets  
File Role Description
Files folder imageAdapter (1 file)
Files folder imageData (1 file)
Files folder imageReport (1 file)
Files folder imagetmp (1 file)

  Files folder image Files  /  tests  /  Assets  /  Adapter  
File Role Description
  Plain text file WithoutInterface.php Class Class source

  Files folder image Files  /  tests  /  Assets  /  Data  
File Role Description
  Accessible without login Plain text file Corrupt.yml Data Auxiliary data

  Files folder image Files  /  tests  /  Assets  /  Report  
File Role Description
  Plain text file InvalidReport.php Class Class source

  Files folder image Files  /  tests  /  Assets  /  tmp  
File Role Description
  Accessible without login HTML file index.html Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:230
This week:0
All time:7,576
This week:1,099Up