# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Form Enhancer Pro is a WordPress plugin that extends Fluent Forms with additional fields, integrations, and features. It's built with PHP 8.1+ using a modern architecture with dependency injection, PSR-4 autoloading, and comprehensive testing.

## Architecture

### Directory Structure
- `src/` - Free version classes (namespace: `FormEnhancer\`)
- `srcPro/` - Pro version classes (namespace: `FormEnhancerPro\`)
- `srcDepsPro` - Composer dependencies for PRO version that is later on stripped off.
- `vendor/deps/` - Scoped dependencies for free version
- `vendor/depsPro/` - Scoped dependencies for pro version
- `tests/unit/` - PHPUnit test files

### Key Components
- **Plugin.php** - Main plugin class using DI container
- **Admin.php** - WordPress admin integration
- **Settings.php** - Plugin settings management
- **FluentForm/Integration.php** - Fluent Forms integration layer
- **FluentForm/Fields/** - Custom form fields implementation

### Dependency Management
The plugin uses PHP-DI for dependency injection with scoped vendor dependencies to avoid conflicts. The main container is created in `formenhancer_container()` function.

## Development Commands

### PHP Standards & Testing
```bash
# Check coding standards
composer standards:check

# Fix coding standards automatically  
composer standards:fix

# Run unit tests
composer test

# Run tests with coverage report
composer test:report

# Run tests with HTML coverage report
composer test:report:html

# Clear PHPUnit cache
composer test:clear-cache
```

### JavaScript Build
```bash
# Build for production
npm run build

# Start development mode
npm run start
```

### Additional Commands
```bash
# Install pro dependencies
composer install-deps

# Run PHP compatibility check
composer qit:phpcompatibility
```

## Plugin Structure

### Freemius Integration
The plugin uses Freemius SDK for licensing and has conditional loading of pro features based on license status.

### Form Fields Architecture
Custom fields extend base classes and integrate with Fluent Forms through:
- Field registration in Integration class
- Validation handlers in Fields/Validate/ directory
- Frontend rendering via Fluent Forms hooks

### Pro vs Free Features
Pro features are conditionally loaded using Freemius `is__premium_only()` checks and separate namespace/directory structure.

## Testing

Tests use PHPUnit with WP_Mock for WordPress function mocking. Test files should be placed in `tests/unit/` and follow the naming convention `*Test.php`.

## Code Standards

The project follows WordPress and Eightshift coding standards with additional rules:
- PHP 8.1+ features encouraged
- PSR-4 autoloading
- Dependency injection preferred
- Comprehensive PHPDoc comments required
- WordPress security best practices enforced