Skip to content

djdaca/nette-csv-response

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CSV Response

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' )
;

About

Nette CSV response

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%