PHP code example of phuxtil / find

1. Go to this page and download the library: Download phuxtil/find library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

phuxtil / find example snippets


$configurator = (new FindConfigurator())
     ->setFormat('%As|%Cs|%Ts|%#m|%u|%g|%U|%G|%y|%i|%b|%s|%n|%f|%p')
     ->setFormatDelimiter('|')
     ->setLineDelimiter("\n")
     ->setFindOutput(...);

$results = (new FindFacade())->process($configurator);

[
    0 => Phuxtil\SplFileInfo\VirtualSplFileInfo {
        path: "/tmp"
        filename: "remote_fs"
        basename: "remote_fs"
        pathname: "/tmp/remote_fs"
        extension: ""
        realPath: "/tmp/remote_fs"
        aTime: 2019-06-16 12:49:48
        mTime: 2019-06-16 12:49:41
        cTime: 2019-06-16 12:49:41
        inode: "10245134"
        size: "160"
        perms: 0755
        owner: "0"
        group: "0"
        type: "dir"
        writable: true
        readable: true
        executable: true
        file: false
        dir: true
        link: false
        linkTarget: -1
      }
      1 => Phuxtil\SplFileInfo\VirtualSplFileInfo {
        path: "/tmp/remote_fs"
        filename: "test.txt"
        basename: "test.txt"
        pathname: "/tmp/remote_fs/test.txt"
        extension: "txt"
        realPath: "/tmp/remote_fs/test.txt"
        aTime: 2019-06-16 12:49:22
        mTime: 2019-06-16 12:49:41
        cTime: 2019-06-16 12:49:41
        inode: "10269956"
        size: "1210"
        perms: 0644
        owner: "0"
        group: "0"
        type: "file"
        writable: true
        readable: true
        executable: false
        file: true
        dir: false
        link: false
        linkTarget: -1
      }
      2 => Phuxtil\SplFileInfo\VirtualSplFileInfo {
        path: "/tmp/remote_fs"
        filename: "test_link.txt"
        basename: "test_link.txt"
        pathname: "/tmp/remote_fs/test_link.txt"
        extension: "txt"
        realPath: "/tmp/remote_fs/test_link.txt"
        aTime: 2019-06-16 12:49:22
        mTime: 2019-06-16 12:49:41
        cTime: 2019-06-16 12:49:41
        inode: "10269956"
        size: "1210"
        perms: 0644
        owner: "0"
        group: "0"
        type: "file"
        writable: true
        readable: true
        executable: false
        file: true
        dir: false
        link: false
        linkTarget: -1
      }
]

echo $results[0]->getPathname();    # /tmp/remote_fs
echo $results[1]->isReadable();     # true
echo $results[2]->getSize();        # 1210