Skip to content

Add comprehensive PHP to Java migration planning documentation#163

Draft
Claude wants to merge 3 commits intomainfrom
claude/plan-language-change-to-java
Draft

Add comprehensive PHP to Java migration planning documentation#163
Claude wants to merge 3 commits intomainfrom
claude/plan-language-change-to-java

Conversation

@Claude
Copy link

@Claude Claude AI commented Feb 6, 2026

Planning documentation for migrating the 181-file PHP application to Java 21 with Spring Boot.

Documentation Structure

Strategic Plan (MIGRATION_PLAN_PHP_TO_JAVA.md - 722 lines)

  • 11-phase implementation plan spanning 26 weeks
  • Phase breakdowns: Foundation → Domain Model → Database → IMAP → Email Processing → AI → API → Frontend → Testing → Deployment → Documentation
  • Technical decisions: Spring Boot 3.2+, Maven, Flyway, JavaMail API, JUnit 5
  • Risk analysis with mitigation strategies
  • Resource requirements: 2-3 developers, 1 QA, 0.5 DevOps

Implementation Guide (docs/migration/GETTING_STARTED_JAVA.md - 469 lines)

  • Spring Boot project setup with complete Maven configuration
  • Sample implementations for core components:
    • JPA entity with status enums (Thread.java)
    • Repository interfaces extending JpaRepository
    • REST controller with CRUD operations
  • Docker Compose configuration for local development
  • Step-by-step instructions from project creation to first API call

File Mapping Reference (docs/migration/PHP_TO_JAVA_MAPPING.md - 267 lines)

  • Complete mapping of 181 PHP files to Java equivalents
  • Directory structure transformation (class/ → domain/ + service/)
  • Class-by-class conversion guide for 57 core classes
  • Library mappings: PHPMailer → JavaMail, PDO → Spring Data JPA, PHPUnit → JUnit 5
  • PHP function to Java method equivalents (json_encode → ObjectMapper, file_get_contents → Files.readString)

Executive Summary (docs/migration/README.md - 235 lines)

  • Migration scope: 181 files, 57 classes, 30 SQL migrations, 6 external integrations
  • Quick reference to all planning documents
  • Immediate next steps for stakeholders and developers

Migration Scope

  • 57 core classes across domain model, IMAP handling, email processing, and AI integration
  • 30 SQL migrations to convert from numbered format to Flyway versioning (V001__*.sql)
  • 6 external integrations to maintain: PostgreSQL, MySQL (Roundcube), IMAP, SendGrid, OpenAI, Auth0
  • Scheduled tasks conversion from cron-triggered PHP scripts to Spring @scheduled annotations

Key Architectural Changes

PHP Pattern                  → Java/Spring Pattern
─────────────────────────────────────────────────
Singleton classes            → @Service beans with DI
require_once dependencies    → Constructor injection
Global functions             → Static utility methods
PDO + SQL                    → Spring Data JPA repositories
Cron scripts                 → @Scheduled methods
Session auth                 → JWT/OAuth2 with Spring Security
Mixed HTML/PHP               → Thymeleaf templates or REST+SPA

Example: Thread Entity Migration

PHP (class/Thread.php):

class Thread {
    const SENDING_STATUS_STAGING = 'STAGING';
    var $id;
    var $sending_status;
    var $my_email;
    // ... 40+ properties
}

Java (domain/Thread.java):

@Entity
@Table(name = "threads")
@Data
public class Thread {
    @Id
    private String id;
    
    @Enumerated(EnumType.STRING)
    private SendingStatus sendingStatus;
    
    @Column(name = "my_email")
    private String myEmail;
    
    @OneToMany(mappedBy = "thread")
    private List<ThreadEmail> emails;
    
    public enum SendingStatus {
        STAGING, READY_FOR_SENDING, SENDING, SENT
    }
}

All documentation follows project conventions and provides actionable implementation guidance for systematic migration.

Original prompt

Plan a change of language from PHP to Java

Claude AI and others added 2 commits February 6, 2026 08:02
Co-authored-by: HNygard <168380+HNygard@users.noreply.github.com>
Co-authored-by: HNygard <168380+HNygard@users.noreply.github.com>
@Claude Claude AI changed the title [WIP] Plan change of language from PHP to Java Add comprehensive PHP to Java migration planning documentation Feb 6, 2026
@Claude Claude AI requested a review from HNygard February 6, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants