Skip to content

Library for streaming files inline or as (resumable) download to a client.

License

Notifications You must be signed in to change notification settings

DigiLive/fileStreamer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fileStreamer

GitHub release License

This library serves a file according to the headers which are sent with a http request. It supports resumable downloads or streaming the content of a file to a client.

If you have any questions, comments or ideas concerning this library, please consult the code documentation at first. Create a new issue if your concerns remain unanswered.

Features

  • Inline disposition.
  • Attachment disposition.
  • Serve a complete file.
  • Serve a single byte range of a file.
  • Serve multiple byte ranges of a file.
  • Set a custom mimetype.

Requirements

  • PHP ^7.4
  • ext-fileinfo *

Installation

The preferred method is to install the library with Composer.

> composer require digilive/file-streamer:^1

Set the version constraint to a value which suits you best.
Alternatively you can download the latest release from GitHub.

Example use

<?php

use DigiLive\FileStreamer\FileStreamer;

// Use composer's auto loader.
$requiredFile = 'Path/To/vendor/autoload.php';

// Or include the library manually.
// $requiredFile = 'Path/To/FileStreamer.php';

require_once $requiredFile;

// Instantiate the library.
$fileStreamer = new FileStreamer('Path/To/File/To/Serve.ext');
// Set inline disposition if wished.
$fileStreamer->setInline();
$fileStreamer->start();
// Execution of PHP will terminate when FileStreamer::start() is finished.

About

Library for streaming files inline or as (resumable) download to a client.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages