msgframework / file
v0.1.3
2022-04-25 19:10 UTC
Requires
- php: >=7.4
- symfony/mime: ^5.4
README
About
This library provides utilities for the file.
Usage
Create file
... use Msgframework\Lib\File\File; $file = new File($path);
Get file extension
... $file = new File($path); $allow_extensions = array('jpg', 'png'); if (!in_array($extension = $file->getExtension(), $allow_extensions)) { throw new \RuntimeException(sprintf('File extension "%s" not allowed, allow: %s', $extension, implode(", ", $allow_extensions))); }
Get file content
... $file = new File($path); $content = $file->getContent();
Installation
You can install this package easily with Composer.
Just require the package with the following command:
$ composer require msgframework/file