Skip to content

Commit

Permalink
Initial Code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiLive committed Feb 17, 2022
1 parent ea4891c commit 194ba30
Show file tree
Hide file tree
Showing 9 changed files with 1,230 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## First Release (Soon)

* No changes.
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# fileStreamer

[![GitHub release](https://img.shields.io/github/v/release/DigiLive/fileStreamer?include_prereleases)](https://github.com/DigiLive/gitChangelog/releases)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

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](https://github.com/DigiLive/fileStreamer/issues/new) 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.

## Requirements

* PHP ^7.4
* ext-fileinfo *

## Installation

The preferred method is to install the library
with [Composer](http://getcomposer.org).

```sh
> 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](https://github.com/DigiLive/fileStreamer/releases).

## Example use

```php
<?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.
```
40 changes: 40 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "digilive/file-streamer",
"description": "Stream a file or serve a file as (resumeable) download",
"keywords": [
"php",
"download",
"resumeable",
"stream"
],
"type": "library",
"minimum-stability": "stable",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Ferry Cools",
"email": "info@digilive.nl"
}
],
"require": {
"php": ">=7.4",
"ext-fileinfo": "*"
},
"require-dev": {
"digilive/git-changelog": "^v1.0.1",
"phpunit/phpunit": "^9",
"mikey179/vfsstream": "^1.6"
},
"autoload": {
"psr-4": {
"DigiLive\\FileStreamer\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"DigiLive\\": "tests/supportFiles/DigiLive/",
"DigiLive\\FileStreamer\\Tests\\": "tests/",
"DigiLive\\FileStreamer\\": "tests/supportFiles/"
}
}
}
Loading

0 comments on commit 194ba30

Please sign in to comment.