Skip to content

Instantly share code, notes, and snippets.

@jamesmacwhite
Last active July 31, 2025 20:37
Show Gist options
  • Save jamesmacwhite/7aeb1da95bb352e0f60fda71499aeb85 to your computer and use it in GitHub Desktop.
Save jamesmacwhite/7aeb1da95bb352e0f60fda71499aeb85 to your computer and use it in GitHub Desktop.
Craft Cloud JSON schema for PHPStorm, VSCode and other IDEs for YAML validation
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Craft Cloud Config File",
"type": "object",
"required": [
"php-version"
],
"properties": {
"php-version": {
"type": "string",
"enum": ["8.1", "8.2", "8.3", "8.4"],
"description": "Required. Major and minor PHP version (e.g., '8.2')."
},
"node-version": {
"type": "string",
"pattern": "^\\d+$",
"description": "Optional. Major Node.js version (e.g., '18')."
},
"node-path": {
"type": "string",
"description": "Optional. Directory for NPM build commands."
},
"npm-script": {
"type": "string",
"description": "Optional. Name of the script in package.json to run at build time."
},
"artifact-path": {
"type": "string",
"description": "Optional. Directory to be uploaded to CDN after build."
},
"app-path": {
"type": "string",
"description": "Optional. Path where your PHP application lives."
},
"webroot": {
"type": "string",
"description": "Optional. Public directory containing index.php."
},
"redirects": {
"type": "array",
"items": {
"type": "object",
"required": [
"pattern",
"destination"
],
"properties": {
"pattern": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"protocol": {
"type": "string"
},
"hostname": {
"type": "string"
},
"pathname": {
"type": "string"
},
"search": {
"type": "string"
},
"hash": {
"type": "string"
}
},
"additionalProperties": false
}
],
"description": "URLPattern-compatible matcher for request URLs."
},
"destination": {
"type": "string",
"description": "URL or template for the redirect target, supporting substitutions like {request.uri}."
},
"status": {
"type": "integer",
"enum": [
301,
302
],
"description": "Optional HTTP status code (301 for permanent, 302 for temporary)."
}
},
"additionalProperties": false
}
},
"rewrites": {
"type": "array",
"items": {
"type": "object",
"required": [
"pattern",
"destination"
],
"properties": {
"pattern": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"protocol": {
"type": "string"
},
"hostname": {
"type": "string"
},
"pathname": {
"type": "string"
},
"search": {
"type": "string"
},
"hash": {
"type": "string"
}
},
"additionalProperties": false
}
],
"description": "URLPattern-compatible matcher for request URLs."
},
"destination": {
"type": "string",
"description": "Internal routing path or target handler."
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment