PHP code example of blat / phencil

1. Go to this page and download the library: Download blat/phencil 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/ */

    

blat / phencil example snippets




= new Phencil\App();

$app->get('/', function() {
    return "Hello world!";
});

$app->run();

$app = new Phencil\App([
    'templates' => __DIR__ . '/templates',
]);

$app->get('/{name}', function($name) {
    return $this->render('hello', ['name' => $name]);
});

<p>Hello <?= $name 

$app->get('/', function() {
    $foo = $this->getParam('foo');
});

$app->get('/', function() {
    $file = $this->getFile('bar');
});

$app->get('/', function() {
    $this->redirect('/login');
});

$app->get('/download/', function() {
    $this->sendFile('/path/to/some-file.txt', 'pretty-name.txt');
});