Download the PHP package webfiori/file without Composer
On this page you can find all versions of the php package webfiori/file. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webfiori/file
More information about webfiori/file
Files in webfiori/file
Informations about the package file
File
Basic class library to read, write and view files using PHP.
Content
- Supported PHP Versions
- Main Aim of The Library
- Usage
- Reading a File
- Creating New File
- Appending to Existing File
- Overriding a File
- Encoding or Decoding of Files
- Decoding
- Reading and Storing Encoded Files
- Display a File
- Chunking File
Supported PHP Versions
Build Status |
---|
Main Aim of The Library
The main aim of the library is to have an OOP abstraction that simplifies most common operations with files in PHP.
Usage
Reading a File
Also, it is possible to read a specific range of bytes by supplying the range to the method File::read()
Creating New File
Appending to Existing File
Overriding a File
Encoding or Decoding of Files
Base64 encoding and decoding is usually used to make sure that binary data is stored and transmitted reliably from one place to another. For more information, read here
Decoding
Reading and Storing Encoded Files
The method File::writeEncoded()
is used to write base 64 enceded binary files as follows.
The method File::readDecoded()
is used to read base 64 enceded binary files as follows.
Display a File
The method File::view()
is used to dispatch the content of the file to front-end. It also supports the header content-range
which can be used to get partial file content.
To trigger a download dialog in web browser, supply true
as argument to the method File::view()
.
Chunking Files
Usually, when a big file is stored in a database table, it is encoded then divided into smaller chunks, and each chunk is stored in a record. The class provides a single method for doing such procedure.
Supplying false
as second parameter to the method will disable base 64 encoding.