Hello, Scratch! Hello, Scratch! Hello, Scratch!

See Github

Download

Documentation

  • Introduction
    • About Scratch PHP
    • Getting Started
    • Application Life Cycle
    • Extensibility

API

  • Theme API
    • Template Content
    • Template Assets
    • Page Title
    • Component
    • Block
    • Snippet
    • Asset Links
  • Extensions
    • Registration
    • Settings Registry
    • Extension Interface
    • ListensTo Attribute
  • Commands
    • Build Command
    • Create Theme
    • Create Template
    • Create Component
    • Create Block
  • Events
    • PageBuildStartedEvent
    • HTMLBuildCompletedEvent
    • CSSBuildCompletedEvent
    • JSBuildCompletedEvent
    • ComponetHTMLCollectedEvent
    • ComponentCSSCollectedEvent
    • ComponentJSCollectedEvent
    • BlockCSSCollectedEvent
    • BlockJSCollectedEvent

Commands

ScratchPHP includes a powerful command-line interface (CLI) that lets you build your static site and scaffold elements like components, blocks, and templates with ease.

Build Command

You can build all the pages by running php bin/scratch build. This command accepts 2 options:

  • --pageJson=index.json To build just a specific page
  • --baseUrl= To add base URL to the config. By default, the base URL is \

Create Theme

To create a new theme, you can execute php bin/scratch create:theme <theme_name>.

Create Template

To create a new template within the theme, you can execute php bin/scratch create:template <template_name>.

Create Component

To create a new component, php bin/scratch create:component <component_name>.

Create Block

To create a new block, php bin/scratch create:block <block_name>.

ScratchPHP by Rom Terrado. The website is proudly built with ScratchPHP. This page is updated since July 15, 2025 9:42 AM.