1. Go to this page and download the library: Download cspray/blogisthenics 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/ */
cspray / blogisthenics example snippets
declare(strict_types=1);
namespace Acme\BlogisthenicsDemo;
use Cspray\AnnotatedContainer\Attribute\Service;use Cspray\Blogisthenics\Template\MethodDelegator;use Cspray\Blogisthenics\Template\TemplateHelperProvider;
#[Service]
final class MyTemplateHelperProvider implements TemplateHelperProvider {
public function addTemplateHelpers(MethodDelegator $methodDelegator) : void {
$methodDelegator->addMethod('myHelper', function() {
return 'This is my helper content!';
});
}
}
declare(strict_types=1);
namespace Acme\BlogisthenicsDemo;
use Cspray\AnnotatedContainer\Attribute\Service;use Cspray\Blogisthenics\Template\Formatter;
#[Service]
final class MyCustomFormatter implements Formatter {
public function getFormatType() : string {
return 'my-type';
}
public function format(string $contents) : string {
return 'my formatted ' . $contents;
}
}
declare(stric_types=1);
use Cspray\AnnotatedContainer\Attribute\Service;use Cspray\Blogisthenics\Site;use Cspray\Blogisthenics\SiteGeneration\DynamicContentProvider;
#[Service]
final class MyContentProvider implements DynamicContentProvider {
public function addContent(Site $site) : void {
// Construct your Content and call $site->addContent($content)
}
}
// Inside a Page or Layout
<?= $this->kv()->get('foo/bar.baz.qux')
declare(strict_types=1);
use Cspray\AnnotatedContainer\Attribute\Service;use Cspray\Blogisthenics\SiteData\DataProvider;
#[Service]
class MyDataProvider implements DataProvider {
public function addData(KeyValueStore $keyValue) : void {
// add whatever data is appropriate
}
}
md
<!-- Stored in the content directory with the filename `index.md` -->
{
"title": "Home Page"
}
# <?= $this->title
md
<!-- some file ending in .md -->
<?= $this->myHelper()
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.