Download the PHP package shemgp/http-send-file without Composer

On this page you can find all versions of the php package shemgp/http-send-file. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package http-send-file

HTTP send file

Sends a file with support for (multiple) range requests. It is able to throttle the download. It is quite small and simple.

This class resembles the php http_send_file from PHP pecl

See:

http://php.net/manual/en/function.http-send-file.php

Install

With composer add to your "require" section:

composer require shemgp/http-send-file

Usage example:


use diversen\sendfile;
$s = new sendfile();

// if you don't set type - we will try to guess it
$s->contentType('application/epub+zip');

// if you don't set disposition (file name user agent will see)
// we will make a file name from file
$s->contentDisposition('test.epub');

// chunks of 40960 bytes per 0.1 secs
// if you don't set this then the values below are the defaults
// approx 409600 bytes per sec
$s->throttle(0.1, 40960);

// file
$file = '/some/dir/test.epub';

// send the file
try {
    $s->send($file);
} catch (\Exception $e) {
    echo $e->getMessage();
}

So you could just do like this:


use diversen\sendfile;
$s = new sendfile();

// file
$file = '/some/dir/test.epub';

// send the file
try {
    $s->send($file);
} catch (\Exception $e) {
    echo $e->getMessage();
}

// but check the headers if it is not
// working as expected as the guessing
// of content-type does not always work
// correctly. 

Without sending content-disposition header:


// without sending content-disposition header
// 2. param = false
try {
    $s->send($file, false);
} catch (\Exception $e) {
    echo $e->getMessage();
}

Send file as inline:


// Send as inline
// 3. param = false
try {
    $s->send($file, true, false);
} catch (\Exception $e) {
    echo $e->getMessage();
}

Credits

Much of the code is taken (and rewritten) from here:

http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/

The process is nicely explained here:

http://www.media-division.com/the-right-way-to-handle-file-downloads-in-php/

MIT © Dennis Iversen, Shem Pasamba


All versions of http-send-file with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package shemgp/http-send-file contains the following files

Loading the files please wait ....