write-script-php

Write PHP scripts for Windmill with typed resources, dependencies, and CLI preview workflows.

1|Updated Aug 3, 2026
One-click install
npx skills add https://github.com/vpzed-dev/smithy --skill write-script-php-vpzed-dev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: write-script-php
Source: https://github.com/vpzed-dev/smithy/tree/main/windmill/local-dev/.agents/skills/write-script-php
Command: npx skills add https://github.com/vpzed-dev/smithy --skill write-script-php-vpzed-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing PHP scripts for the Windmill platform requires following specific conventions — a main function, resource type classes, comment-based dependency declarations, and metadata files that must stay in sync. This Skill encodes all of those rules so generated scripts work correctly on the first run. ## Core Features & Use Cases - Correct PHP script structure: Enforces the <?php header, a main function entrypoint, and resource type classes guarded by class_exists checks. - Dependency and resource handling: Declares Composer libraries via // require: comments and maps Windmill resources to typed PHP class parameters. - CLI workflow guidance: Distinguishes wmill script preview (local iteration) from wmill script run (deployed version) and keeps .lock, .script.yaml, and wmill-lock.yaml synchronized via wmill generate-metadata. - Use Case: You need a PHP script that queries a PostgreSQL database on Windmill. The Skill generates the script with a Postgresql resource class, previews it locally with sample arguments, and regenerates the lock metadata before you deploy. ## Quick Start Write a Windmill PHP script that accepts a PostgreSQL resource and a limit parameter, then preview it locally with sample arguments.

Frequently Asked Questions about write-script-php

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a PHP script for Windmill?▼

Start the file with `<?php` and define at least one function named `main` whose parameters become the script's input schema. Declare Composer libraries with `// require:` comment lines before `main`, and preview the script locally with `wmill script preview <path>`.

How do I use Windmill resources in a PHP script?▼

Redefine the resource type as a PHP class before `main`, guarded by `class_exists` to avoid redeclaration, and type-hint it as a parameter of `main`. The class name must exactly match the Windmill resource type name, and Windmill injects the resource values at runtime.

What is the difference between wmill script preview and script run?▼

`wmill script preview` executes the local script file without deploying, making it the default for iterating on edits. `wmill script run` executes the version already deployed in the workspace and should only be used when you explicitly want to test the deployed version.

How do I add Composer dependencies to a Windmill PHP script?▼

List each package on its own line as a `// require:` comment before the `main` function, optionally with a version constraint like `stripe/stripe-php@^10.0`. Autoloading is handled automatically, so no manual require of the autoloader is needed.

Why is my Windmill lock file out of sync after editing a script?▼

Editing script content, especially adding imports or changing `main`'s arguments, invalidates the content hash tracked in `wmill-lock.yaml` and leaves the `.lock` and `.script.yaml` files stale. Run `wmill generate-metadata` to regenerate them, or `wmill generate-metadata rehash` if only hashes need refreshing.