PHP code example of laasti / response

1. Go to this page and download the library: Download laasti/response library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laasti / response example snippets


$viewdata = new Laasti\Response\Data\ArrayData;
$engine = new Laasti\Response\Engines(['/path/to/templates']);
$responder = new Laasti\Response\Responder($viewdata, $engine);

$responder->setData('title', 'Hello world');
$responder->setData('meta.description', 'Dummy page'); //Accessible in the template using $meta['description']

$response = $responder->view('template_name');

//Output response
$response->send();