---
title: Config Block Syntax — PHP
description: "## Delimiters A PHP config block begins with `// === BEGIN CONFIG ===` and ends with `// === END CONFIG ===`. Any run of equals signs works (for example `// == BEGIN CONFIG ==`), and whitespace around them is tolerated,…"
url: "https://brightleafdigital.io/docs/config-block-syntax-php/"
updated: "2026-10-20"
category: GravityOps Code Snippet Manager / Config Blocks
---

# Config Block Syntax — PHP

## Delimiters

A PHP config block begins with `// === BEGIN CONFIG ===` and ends with `// === END CONFIG ===`. Any run of equals signs works (for example `// == BEGIN CONFIG ==`), and whitespace around them is tolerated, but the keywords are case-sensitive. The block must appear before any executable PHP code.

```
<?php
// === BEGIN CONFIG ===
$form_id   = 5;
$admin_url = 'https://example.com/wp-admin/';
const NOTIFY_EMAIL = 'admin@example.com';
define( 'MAX_ENTRIES', 100 );
// === END CONFIG ===

// ... rest of snippet ...
```

Block-comment delimiters are also accepted for PHP snippets:

```
<?php
/* === BEGIN CONFIG === */
$form_id = 5;
/* === END CONFIG === */
```

## Supported declaration types

| Kind | Syntax | Example |
| --- | --- | --- |
| Variable | `$name = value;` | `$form_id = 5;` |
| Constant | `const NAME = value;` | `const REDIRECT_URL = 'https://example.com';` |
| Define | `define('NAME', value);` | `define('MAX_RETRIES', 3);` |

## Allowed values

Values should be simple literal expressions. GOCSM validates each value before storing and injecting it.

Allowed:

- Integers: `5`, `-1`
- Floats: `3.14`
- Strings: `'hello'`, `"world"`
- Booleans: `true`, `false`
- `null`
- Arrays of literals: `[1, 2, 3]`, `['a', 'b']`

Not allowed (rejected with an error):

- Function calls: `get_option('foo')`, `time()`
- Variable references: `$other_value`
- Bare constants such as `ABSPATH`
- Backtick execution: ``ls``
- Control flow, includes, class/function declarations, and similar executable constructs

## Annotations

Add a docblock annotation immediately above a declaration to give it a label and hint:

```
/** @config int The form ID to process submissions from */
$form_id = 5;
```

Syntax: `/** @config <type>[:<params>] <description> */`

The annotation must be a `/** */` docblock. Annotations written as `//` or `/* */` comments are ignored.

In v1, all config variables render as plain text inputs regardless of the type annotation. Typed inputs are planned for v2.
