Skip to content

Static Site Generator ​

The same TinyTank site can be published two ways: as the PHP site (on a server with PHP, Deploying), or as plain files for a static host such as Cloudflare, with no PHP on the server. TinyTank is then a static site generator, with everything you develop with: Twig templates, Markdown content, data collections, translations, SEO, responsive images, Datastar in the browser, and even forms.

You keep developing as usual (npm run dev, the PHP site at your local address); only the last step changes:

sh
npm run build                             # the CSS and JavaScript
php bin/console build:static              # the whole site, as files, in deploy/
php bin/console preview:static            # check it locally, as the host will serve it
php bin/console publish:static            # put it online (Cloudflare Workers)

Static or PHP? ​

StaticPHP
Hostingfree on Cloudflare for most sites; nothing to maintain or updatea server with PHP 8.4
Speed and resilienceevery page is a file, served from Cloudflare's networkfast too (compiled ahead of time, CDN caching optional)
Formssent by a small Worker (Forms): checks and spam honeypot, no rate limiteverything (Forms)
Server-side featuresnone: what needs the server is listed by the buildroutes and controllers, Datastar server actions
Changes go liverebuild and publishbin/console deploy

Most sites that only show content (a studio, a portfolio, a blog, documentation) can be static. You can switch at any time: the same site builds both ways.

In this section ​

  • How it works: how pages are found and written, and broken links.
  • Configuration: the static options in config/app.php.
  • What needs the server: what can't work without PHP, and site.static.
  • Search: the blog search, filtered in the browser.
  • Forms: contact forms answered by a Cloudflare Worker.
  • Hosts: Cloudflare, any static host, or your own adapter.
  • Preview: the build served locally, exactly as published.
  • Publishing: the API token and publish:static.
  • Troubleshooting: what can go wrong, and how to find out why.

TinyTank documentation