slendium / slendium-static
Static website generator.
Requires
- php: ^8.5
- ext-dom: *
- ext-libxml: *
- erusev/parsedown: ^1.8
- slendium/compositor: ^0.2
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.5.8
README
Static website generator.
Installation
Requires PHP >= 8.5, Composer and npm. Simply
run composer install slendium/slendium-static to add it to your project.
Usage
Create a content/ directory and a slendium-static.php configuration file in the root of your project.
Each file in the content/ directory corresponds to a page of the generated site. Pages can be created
using either HTML or Markdown. Running the script at vendor/bin/generate-site will generate the site
in the public/ directory.
Examples
Default configuration file
The configuration file lives at slendium-static.php in the root directory of your project. It should
return an ArrayAccess|array where each key is a configuration name. Use the ConfigsBuilder for
type-safe configuration, as in the example below.
return new ConfigsBuilder() ->setTitleTemplate(static fn($localTitle) => "$localTitle - My Website") ->setBaseSectionProvider(new ArraySectionProvider([ SectionNames::HEADER => new HtmlSection('Enter your header-HTML here'), SectionNames::FOOTER => new HtmlSection('Enter your footer-HTML here'), ])) ->build();
Roadmap
- [Done] Static pages based on HTML or Markdown only
- [Done] Include a global stylesheet
- Integrate compositor library
- Support for multi-locale sites
- Page generation (for pagination of blogs, product pages, or similar)
- Integrate JS/CSS minification strategies
- Auto-optimized images with support for cropping based on screen size
- Validating site integrity by checking all internal links