-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
DigiLive
committed
Feb 17, 2022
1 parent
ea4891c
commit 194ba30
Showing
9 changed files
with
1,230 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
## First Release (Soon) | ||
|
||
* No changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/" | ||
} | ||
} | ||
} |
Oops, something went wrong.