2017 © Pedro Peláez
 

library text-as-file-response

Text as file response extension for Nette Framework

image

joseki/text-as-file-response

Text as file response extension for Nette Framework

  • Tuesday, July 22, 2014
  • by castamir
  • Repository
  • 1 Watchers
  • 0 Stars
  • 744 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

TextAsFileResponse

Build Status, (*1)

Text as file response for Nette Framework, (*2)

Install

Installation via Composer., (*3)

{
    "require":{
        "joseki/text-as-file-response": "@dev"
    }
}

Download a file from a template

// in a Presenter
public function actionDownload()
{
    $template = $this->createTemplate();
    $template->setFile("/path/to/template.latte");
    $template->someValue = 123;

    $response = new Joseki\Application\Responses\TextAsFileResponse($template, 'MyFilename.txt');

    $this->sendResponse($response);
}

Download a file from a string

// in a Presenter
public function actionDownload()
{
    $data = 'lorem ipsum...';

    $response = new Joseki\Application\Responses\TextAsFileResponse($data, 'MyFilename.txt');

    $this->sendResponse($response);
}

Setting content type

// in a Presenter
public function actionDownload()
{
    $response = new Joseki\Application\Responses\TextAsFileResponse($data, 'MyFilename.xml', 'application/xml');

    $this->sendResponse($response);
}

The Versions

22/07 2014

dev-master

9999999-dev

Text as file response extension for Nette Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

22/07 2014

v1.0.0

1.0.0.0

Text as file response extension for Nette Framework

  Sources   Download

MIT

The Requires

 

The Development Requires