PHP code example of jyoungblood / stereo-render
1. Go to this page and download the library: Download jyoungblood/stereo-render 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/ */
jyoungblood / stereo-render example snippets
use Stereo\render;
$app->get('/', function ($req, $res, $args) {
return render::html($req, $res, '<h2>Hey whats up</h2>');
});
$app->get('/', function ($req, $res, $args) {
return render::html($req, $res, 'hey/whats-up.html');
});
$app->get('/', function ($req, $res, $args) {
return render::text($req, $res, 'Hey whats up');
});
return render::redirect($req, $res, 'https://google.com/');
$app->get('/json/', function ($req, $res, $args) {
$data = [
'name' => 'Ringo',
'friends' => [
'Paul', 'George', 'John'
]
];
return render::json($req, $res, $data);
});
$app->get('/', function ($req, $res, $args) {
return render::blade($req, $res, [
'template' => 'index',
'data' => [
'name' => 'Ringo',
'friends' => [
'Paul', 'George', 'John'
]
],
], 200); // optional status code, 200 by default
});
BLADE_VIEWS_PATH = "views"
BLADE_CACHE_PATH = "cache"
BLADE_MODE = "AUTO"
$app->get('/', function ($req, $res, $args) {
echo render::blade_template('email/test', [
'link' => 'https://jy.hxgf.io',
]);
return $res;
});