---
title: "Naming Conventions"
url: https://festi.dev/8.0/FAQ/Naming/
---

# Naming Conventions

This document captures naming rules that are easy to miss when reading
existing code. Following them up front prevents the most common class of
review comments on Festi merge requests.

## No Acronyms or Abbreviations in Identifiers

Database columns are often abbreviated for historical reasons (`cdate`,
`mdate`, `changefreq`, `lastmod`, `descr`). **Identifiers must always
spell the word out**, even when they wrap an abbreviated column.

| Bad                       | Good                          |
|---------------------------|-------------------------------|
| `FIELD_CDATE`             | `FIELD_CREATE_DATE`           |
| `FIELD_MDATE`             | `FIELD_MODIFY_DATE`           |
| `FIELD_CHANGEFREQ`        | `FIELD_CHANGE_FREQUENCY`      |
| `FIELD_LASTMOD`           | `FIELD_LAST_MODIFIED`         |
| `getChangefreq()`         | `getChangeFrequency()`        |
| `getLastmod()`            | `getLastModified()`           |
| `_buildLandingHost()`     | `_getHost()`                  |
| `$cfg`, `$mgr`, `$svc`    | `$config`, `$manager`, `$service` |

The DB column itself can stay abbreviated — only the constant,
property, parameter, method, or class name needs to be expanded.

```php
public const FIELD_CREATE_DATE = 'cdate';   // OK: constant explains the abbrev
public const FIELD_MODIFY_DATE = 'mdate';   // OK
```

### Why
- Identifiers are read far more often than they are typed.
- Abbreviations only make sense to people who already know the domain.
- Auto-complete makes long names cheap.
- Acronyms lose meaning across teams and time.

## ValuesObject Classes Are Singular

The class wraps **one row**, even if the table is plural.

| Table             | Class                          |
|-------------------|--------------------------------|
| `sitemap_urls`    | `SitemapUrlValuesObject`       |
| `contents_tags`   | `ContentTagValuesObject`       |
| `users`           | `UserValuesObject`             |
| `orders_items`    | `OrderItemValuesObject`        |

The DAO method that returns a list is plural
(`getSitemapUrls()`), but the type hint of each element is singular
(`SitemapUrlValuesObject`).

## Private Members Use a Leading Underscore

```php
private string $_status;
private function _getHost(): string { ... }
```

This is enforced by the Festi PHPCS standard. It applies to private and
protected members; public members do **not** get the prefix.

## Method Verb Conventions

| Prefix    | Returns                                             |
|-----------|-----------------------------------------------------|
| `get*`    | A value (object, array, scalar). No side effects.   |
| `fetch*`  | A rendered template string.                         |
| `is*`     | A boolean.                                          |
| `has*`    | A boolean (existence/ownership).                    |
| `on*`     | An event/route handler. Returns `bool` for routes.  |
| `_*`      | A private helper.                                   |

Mixing these (e.g. `getMain()` for a method that renders a template)
makes the call site harder to read.

## File and Class Names Match Exactly

`SitemapUrlValuesObject.php` must contain `class SitemapUrlValuesObject`
in the namespace declared by its directory. Renaming a class always
means renaming the file in the same commit.
