vojir / nette-csv-response
Nette CSV Responses
v1.2
2019-10-19 20:30 UTC
Requires
- php: >=7.1
- nette/http: >=2.4
- nette/utils: >=2.4
This package is auto-updated.
Last update: 2025-01-20 08:09:03 UTC
README
Use:
class SomePresenter extends BasePresenter { public function actionDefault() { $data = [ [ 'name' => 'George', 'age' => 15, 'grade' => 2, ], [ 'name' => 'Jack', 'age' => 17, 'grade' => 4, ], [ 'name' => 'Mary', 'age' => 17, 'grade' => 1, ], ]; $response = new \Nette\Application\Responses\CsvResponse($data, 'students.csv'); $this->sendResponse( $response ); } }
Individual settings example:
use Nette\Application\Responses\CsvResponse; $response ->setGlue( CsvResponse::SEMICOLON ) ->setOutputCharset( 'cp1250' ) ->setContentType( 'application/csv' ) ->setHeadingFormatter( 'strtoupper' ) ->setDataFormatter( 'trim' ) ;