1. Go to this page and download the library: Download bchubbweb/phntm 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/ */
bchubbweb / phntm example snippets
namespace bchubbweb\PhntmImplementation;
true' to disable profiling
Phntm::init(profile: true);
namespace Pages\Home;
use bchubbweb\phntm\Resources\Page as PageTemplate;
class Page extends PageTemplate
{
public function __construct() {
parent::__construct();
$this->setContent(<<<HTML
<h1>home</h1>
HTML);
}
}
namespace Pages;
use bchubbweb\phntm\Resources\Layout as LayoutTemplate;
class Layout extends LayoutTemplate
{
public function __construct() {
$this->registerAsset('/assets/layout.css');
$this->registerAsset('/assets/layout.js');
$this->setContent(<<<HTML
<html>
<head>
<title>Phntm</title>
<!-- head /-->
</head>
<body>
<header>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
<li><a href="/users">Users</a></li>
</ul>
</nav>
</header>
<main>
<!-- content /-->
</main>
<footer>
<p>Phntm</p>
</footer>
<!-- profiler /-->
</body>
</html>
HTML);
}
}
bash
php -S localhost:3000
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.