PitchHut logo
PHPSSG (Personal Home Page Static Site Generator)
Effortlessly build static sites with pure PHP and composable templates.
Pitch

PHPSSG is a lightweight static site generator that leverages vanilla PHP and automated dependency injection for an easy and efficient development experience. With plain PHP templates and invokable components, creating composable layouts and deploying static pages is seamless and straightforward. Ideal for developers seeking simplicity and portability.

Description

PHPSSG (Personal Home Page Static Site Generator) is a lightweight static site generator that enables developers to create composable templates using pure PHP. This project leverages invokable component classes and output buffering to ensure a clean and intuitive developer experience without requiring any third-party templating engines.

Key Features

  • Use plain PHP templates—no special syntax to learn.
  • Create invokable components like $header(), enhancing simplicity in template usage.
  • Centralized rendering helper eliminates the need for repetitive invoking of ob_start() and ob_get_clean().
  • Nest and compose templates effortlessly (e.g. a Layout containing a Header alongside content).
  • Supports “slots” for passing data or HTML into templates for increased flexibility.
  • Highly portable across various PHP environments.
  • Offers straightforward native debugging capabilities.

Overview of Structure

The project is organized in a way that promotes clarity and maintainability:

  • config/: Contains bootstrap and setup code including autoloaders.
  • public/: The web-facing build directory contains HTML entry points and static assets, keeping PHP source code secure.
  • scripts/: Contains development and build scripts to streamline workflows.
  • contracts/: Defines shared behaviors across application components, facilitating clear interactions and easier documentation.
  • presenters/: Contains PHP classes that act as invokable components, responsible for rendering logic.
  • components/: Reusable UI building blocks, each comprising a presenter and its corresponding view.
  • layouts/: Reusable page skeletons that define the overall structure of pages.
  • pages/: Includes page-level presenters that assemble components and layouts into complete pages.
  • utilities/: Features small helper classes that manage repetitive tasks such as rendering.
  • views/: Contains raw PHP templates organized by their associated presenters, strictly displaying content without business logic.

This organization promotes:

  • A strong separation of logic from markup.
  • Composable components for enhanced usability.
  • Easy maintenance through clearly defined roles for each file and directory.
  • A secure public/ directory ensuring only necessary files are exposed.

Contribution Guidelines

Contributions are encouraged, whether they involve bug fixes, performance improvements, or new feature suggestions. When contributing, adhere to the following principles:

  • Minimalism First: The project is designed to be lightweight; avoid adding unnecessarily complex libraries.
  • Developer-Friendly Workflow: Maintain clarity and ease of use in all components.
  • Consistency: Follow the existing file and structure conventions—use presenters/ for logic, views/ for templates, and utilities/ for shared helpers.
  • Backward Compatibility: Avoid breaking existing APIs unless doing so offers a significant improvement.

Planned Features

  • Full PSR-4 compliance, ensuring adherence to the autoloading standard.
  • Introduction of Renderable and Composable interfaces to help define components and their expected behavior.
  • Enhanced IntelliSense support with comprehensive docblocks.
  • Future tutorials to assist in implementing features such as localization, pagination, and markdown support.
0 comments

No comments yet.

Sign in to be the first to comment.