PHP code example of chevere / danky
1. Go to this page and download the library: Download chevere/danky 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/ */
chevere / danky example snippets
// Quote.php
use Chevere\Danky\Template;
class Quote extends Template
{
public function __construct(string $text, string $author) {
$this->render =
<<<HTML
<quote>"$text" --$author</quote>
HTML;
}
};
// Home.php
use Chevere\Danky\Template;
class Home extends Template
{
public function __construct(Template $content) {
$this->render =
<<<HTML
<main>
$content
</main>
HTML;
}
};
// index.php
use function Chevere\Danky\import;
use Home;
use Quote;
echo
new Home(
content: new Quote(
text: 'Hello, world!',
author: 'Rodolfo'
)
);