write-script-php

Write PHP scripts for Windmill with resource types, dependencies, and CLI testing commands.

Updated May 28, 2026
One-click install
npx skills add https://github.com/kma-core/windmill --skill write-script-php-kma-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-script-php
Source: https://github.com/kma-core/windmill/tree/main/system_prompts/auto-generated/skills/write-script-php
Command: npx skills add https://github.com/kma-core/windmill --skill write-script-php-kma-core

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing PHP scripts for the Windmill platform requires following specific conventions—such as defining a main function, declaring resource type classes, and specifying Composer dependencies as comments—and this Skill ensures every script you write conforms to those rules while guiding you to test with the correct CLI command. ## Core Features & Use Cases - Windmill PHP Conventions: Enforces the required script structure, including the <?php opening tag, a main function, and resource type class definitions guarded by class_exists. - Dependency Declaration: Shows how to specify Composer packages (e.g., guzzlehttp/guzzle, stripe/stripe-php) as // require: comments before the main function. - CLI Workflow Guidance: Distinguishes between wmill script preview for local iteration, wmill script run for deployed scripts, and wmill sync push for explicit deployment. - Use Case: You need a PHP script that connects to a PostgreSQL database on Windmill. The Skill generates a script with a Postgresql resource class, a typed main function, and then previews it locally with sample arguments. ## Quick Start Write a Windmill PHP script that fetches data from an API using Guzzle and 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 inputs. Return values are typically associative arrays, and you can preview the script locally with `wmill script preview <path>`.

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

Declare dependencies as comment lines before the main function using the format `// require:` followed by one package per line, such as guzzlehttp/guzzle or stripe/stripe-php@^10.0. Autoloading is handled automatically, so no manual require is needed.

How do I use resource types like database credentials in a Windmill PHP script?

Redefine the resource type as a PHP class before the main function, wrapped in a `class_exists` check to avoid redeclaration. The class name must exactly match the resource type, and its properties receive the credential values when passed as a parameter to main.

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

`wmill script preview` executes your local script file without deploying it, 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.

When should I run wmill sync push for a PHP script?

Run `wmill sync push` only when you explicitly want to deploy or publish local changes to the workspace. Do not push just to test a script, since pushing overwrites the workspace version with untested changes; use `wmill script preview` instead.