PHP code example of clarkwinkelmann / flarum-mithril2html
1. Go to this page and download the library: Download clarkwinkelmann/flarum-mithril2html 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/ */
clarkwinkelmann / flarum-mithril2html example snippets
return [
new \ClarkWinkelmann\Mithril2Html\Extend\Setup(),
// Your other extenders
];
(new Frontend('mithril2html'))
->js(__DIR__ . '/js/dist/mithril2html.js'),
(new \ClarkWinkelmann\Mithril2Html\Extend\FrontendNoConflict('mithril2html'))
->js(__DIR__ . '/js/dist/mithril2html.js'),
$component = new ClarkWinkelmann\Mithril2Html\AnonymousComponent('hello-world');
echo resolve(ClarkWinkelmann\Mithril2Html\Renderer::class)->render($component);
// <p>Hello World</p>
class InvoiceComponent implements ComponentInterface {
protected $invoice;
public function __construct(Invoice $invoice)
{
$this->invoice = $invoice;
}
public function route(): string
{
return 'invoice';
}
public function preload(): ?string
{
return '/invoices/' . $this->invoice->id;
}
public function actor(): ?User
{
return $this->invoice->user;
}
public function selector(): ?string
{
return '#content';
}
}
$component = new ClarkWinkelmann\Mithril2Html\AnonymousComponent('hello-world');
echo resolve(ClarkWinkelmann\Mithril2Html\Renderer::class)->browsershot($component)->landscape()->pdf();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.