PHP code example of phuxtil / stat

1. Go to this page and download the library: Download phuxtil/stat 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 / stat example snippets


$stat = (new StatFacade())->process(...);

echo $stat->getBlocks();      # 8
echo $stat->getDateAccess();  # DateTime {date: 2019-06-07 18:13:35.0 +00:00}
echo $stat->getDateModify();  # DateTime {date: 2019-06-07 18:13:35.0 +00:00}
echo $stat->getDateChange();  # DateTime {date: 2019-06-07 18:13:35.0 +00:00}
echo $stat->getDevice();      # 57h/87d
echo $stat->getFilename();    # /tmp/foo/bar.txt
echo $stat->getGid();         # 0
echo $stat->getGroup();       # root
echo $stat->getInode();       # 9920467
echo $stat->getIoBlock();     # 4096
echo $stat->getLinks();       # 1
echo $stat->getPermission();  # 644
echo $stat->getSize();        # 70
echo $stat->getType();        # file
echo $stat->getUid();         # 0
echo $stat->getUser();        # root

print_r($stat->toArray());

[
  filename: "/tmp/remote_fs/remote.txt"
  size: 70
  type: "file"
  permission: 644
  dateAccess: DateTime @1559931215 {#4840
    date: 2019-06-07 18:13:35.0 +00:00
  }
  dateModify: DateTime @1559931215 {#4857
    date: 2019-06-07 18:13:35.0 +00:00
  }
  dateChange: DateTime @1559931215 {#4858
    date: 2019-06-07 18:13:35.0 +00:00
  }
  uid: 0
  gid: 0
  user: "root"
  group: "root"
  inode: 9920467
  device: "57h/87d"
  links: 1
  blocks: "8"
  ioBlock: 4096
]

$stat->fromArray([
    'filename' => '/tmp/foo/bar.txt',
    'size' => 70,
    'type' => 'file',
    ...
]);