machichdigital

IDE-Tools · Foto: Homedust, CC BY 2.0

RegelCursor RulesLizenz: CC0 1.0frei kopierbar

Typo3cms Extension

Zuletzt aktualisiert:

⬇ Als Datei laden

⧉ –× kopiert⬇ –× heruntergeladenBewertung:

Typ

Regel

Lizenz

CC0 1.0

Anwendungsfeld

Cursor Rules

Voraussetzungen

Keine besonderen — direkt loslegen.

TYPO3-Regel für PHP-Extension-Entwicklung nach Extbase/Fluid-Konventionen.

Original-Beschreibung der Autoren: Cursor rules for TYPO3 CMS development with extension integration.

Die Regel

---
description: "Cursor rules for TYPO3 CMS development with extension integration."
globs: **/*
alwaysApply: false
---
You are a highly skilled TYPO3 extension developer tasked with creating a new extension. Your goal is to provide a detailed plan and code structure for the extension based on the given project description and specific requirements.

---

### 1. Development Guidelines

- **Use PHP 8.3+ features where appropriate**
- Follow **TYPO3 Coding Guidelines (CGL)** and **Core Team Best Practices**
- Use the **Extension Builder** as a starting point where useful, but favor manual organization for better control
- Apply **PSR-12** coding standards
- Utilize **strict typing**, union types, readonly properties, and modern attributes
- Prefer **dependency injection** over static access or global scope
- Focus on excellent **Developer Experience (DX)**:
  - Clear type annotations
  - IDE autocompletion
  - Precise PHPDoc blocks
  - Consistent naming conventions

---

### 2. Coding Standards and Conventions

- **File Names**: Use `PascalCase.php` (e.g., `MyService.php`)
- **Class and Enum Names**: Use `PascalCase` (e.g., `MyUtilityClass`)
- **Method Names**: Use `camelCase` (e.g., `getUserData`)
- **Variable and Property Names**: Use `camelCase` (e.g., `userService`)
- **Constants and Enum Case Names**: Use `SCREAMING_SNAKE_CASE` (e.g., `DEFAULT_LIMIT`)
- **Namespaces**: Respect PSR-4 autoloading, use `Vendor\ExtensionName\SubNamespace`

---

### 3. Extension Structure and File Organization

```plaintext
my_extension/
├── Classes/
│   ├── Controller/           # Extbase Controllers
│   ├── Domain/
│   │   ├── Model/            # Domain Models
│   │   └── Repository/       # Domain Repositories
│   ├── Service/              # Business logic classes
│   ├── EventListener/        # PSR-14 event subscribers
│   ├── Middleware/           # Custom middlewares (if needed)
│   └── Utility/              # Utility/helper classes
├── Configuration/
│   ├── TCA/                  # Table configuration arrays
│   ├── Services.yaml         # Service container configuration
│   └── ext_localconf.php     # Extension registration
├── Resources/
│   ├── Private/
│   │   ├── Templates/        # Fluid templates
│   │   ├── Partials/
│   │   └── Layouts/
│   └── Public/               # JS, CSS, Images
├── Tests/
│   ├── Unit/                 # PHPUnit unit tests
│   └── Functional/           # Functional tests
├── ext_emconf.php            # Extension metadata
└── composer.json             # Composer configuration

Integration into TYPO3 CMS

  • The extension is installed via Composer or manually via the Extension Manager
  • Services are automatically injected via Services.yaml configuration
  • PSR-14 Events, SignalSlots, and TypoScript are registered via ext_localconf.php
  • Configuration is handled via TypoScript and YAML

4. Testing and Documentation

✅ Testing Strategy

  • Use PHPUnit for both unit and functional tests
  • Use typo3/testing-framework for TYPO3-specific test cases
  • Write tests for:
    • Domain logic (Models, Repositories)
    • Services (pure PHP logic)
    • Controllers (via functional tests)
  • Ensure code coverage and test edge cases

📚 Documentation Structure

  • README.md
    • Extension purpose
    • Installation instructions
    • Minimal usage example
  • Docs/
    • Setup and configuration guides
    • Full usage examples (Fluid templates, TypoScript)
    • API reference (linked with PHPDoc)
  • Code is self-documented with comprehensive PHPDoc

## So nutzt du sie

Die Regel kopieren (Button oben) oder als Datei herunterladen und im Projekt unter `.cursor/rules/` ablegen — Cursor lädt sie beim nächsten Start automatisch. Ältere Cursor-Versionen lesen alternativ eine einzelne `.cursorrules`-Datei im Projektstamm; dort einfach den Regel-Text ohne den Kopfblock zwischen den `---`-Zeilen einfügen.

Der Regel-Text ist englisch — Cursor versteht ihn unabhängig von der Sprache, in der Sie mit dem Editor chatten.


## Im Detail

Diese Regel richtet sich an die PHP-basierte Entwicklung von TYPO3-CMS-Extensions und ist der einzige Eintrag der Gruppe außerhalb des React/TypeScript-Umfelds. Sie gibt der KI TYPO3-spezifische Konventionen vor, etwa zur Extbase/Fluid-Struktur, zur TCA-Konfiguration von Datenbanktabellen und zum üblichen Aufbau eines Extension-Verzeichnisses, statt generischen PHP- oder Symfony-Code vorzuschlagen. Sinnvoll für Agenturen und Entwickler, die bestehende TYPO3-Installationen warten oder neue Extensions bauen, da TYPO3 eigene Namens- und Strukturregeln hat, die ein KI-Modell ohne Kontext leicht verfehlt. Für reine Frontend- oder Non-PHP-Projekte ist die Regel naturgemäß irrelevant.

## Praxis-Tipp

Vor dem Anlegen einer neuen Extension einsetzen, z. B. mit „Erstelle das Grundgerüst einer TYPO3-Extension mit einem Extbase-Controller für News-Einträge“.

## Siehe auch

- [Aspnet Abp](/ki-verzeichnis/ide-tools/aspnet-abp/)

## Lizenz & Quelle

- **Lizenz:** CC0 1.0
- **Quelle:** [PatrickJS/awesome-cursorrules (GitHub)](https://github.com/PatrickJS/awesome-cursorrules)
Inhalt ansehen (typo3cms-extension.mdc)
Lade …

Erfahrungen & Kommentare.

Funktioniert der Regel bei Ihnen? Tipps, Stolperfallen, Varianten — teilen Sie es mit der Community.

Lade Kommentare …

Ihre IP-Adresse wird zum Schutz vor Missbrauch gespeichert und nach 14 Tagen automatisch entfernt (Datenschutz).

Passt dazu.