primipilus / fileinfo
provides information about file
Installs: 2 981
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.1.0
README
Composer install
composer require "primipilus/fileinfo:~1.0"
Usage
$info = new FileInfo($path); echo 'path: ' . $info->path, PHP_EOL; echo 'mime: ' . $info->mime, PHP_EOL; echo 'size: ' . $info->size . ' bytes', PHP_EOL; echo 'dirname: ' . $info->dirname, PHP_EOL; echo 'basename: ' . $info->basename, PHP_EOL; echo 'extension: ' . $info->extension, PHP_EOL; echo 'filename: ' . $info->filename, PHP_EOL; if ($info->isImage) { echo 'width: ' . $info->image->width, PHP_EOL; echo 'height: ' . $info->image->height, PHP_EOL; } $info2 = new FileInfo($path2); $info->equals($info2); // :bool echo $info->sha1, PHP_EOL; echo $info->md5, PHP_EOL; $info->extensionCorrespondsToMime; // :bool $info->extensionsByMime; // :string[]