PHP code example of mattferris / staccato

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

    

mattferris / staccato example snippets


<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>The Frivolous Fancies of Feral Foxes</title>
    <link rel="stylesheet" type="text/css" href="blog.css">
  </head>
  <body>
    <header><h1>The Frivolous Fancies of Foxes</h1</header>
    <article>
      <!-- content goes here -->
    </article>
  </body>
</html>

    <article>
      <header><h1><?= $title 

use MattFerris\Staccato\Staccato;

$vars = [
    'title' => 'Are Foxes Funny or Frightening?',
    'body' => '...';
];

echo (new Staccato())->render('base.tmpl.php', $vars);

 namespace MattFerris\Staccato 

 namespace MattFerris\Staccato 

  <head>
    <meta charset="utf8">
    <title>The Frivolous Fancies of Feral Foxes</title>
     block($_, 'css') 

 block($_, 'css') 

 block($_, 'css') 

 append($_, 'css) 

 namespace MattFerris\Staccato 

 begin($_, 'content') 

use MattFerris\Staccato\Staccato;
use MattFerris\Staccato\Plugins\Cache\FileCache;
use MattFerris\Staccato\Plugins\Cache\CachePlugin;

$path = 'cache/dir'; // path to a directory to store cache entries
$ttl = 3600; // keep cache entries for one hour
$cache = new FileCache('path/to/cache/dir', $ttl);

$staccato = (new Staccato())
    ->addPlugin(new CachePlugin($cache));

 namespace MattFerris\Staccato 

 cache($_, 'myblock', $ttl) 

<?= cincl($_, 'template.tmpl.php', $ttl) 

<?= cfetch($_, 'https://example.com/expensive/api/call', $ttl) 

<?= ncfetch($_, 'https://example.com/feed') 

use MattFerris\Staccato\Staccato;
use MattFerris\Staccato\Plugins\Markdown\MarkdownPlugin;

$staccato = (new Staccato())
    ->addPlugin(new MarkdownPlugin());

 namespace MattFerris\Staccato 
 MattFerris\Staccato\begin($_, 'content')