Free · Daily brief + weekly playbookDaily 60-sec AI Voice Brief + Weekly Production AI Agent PlaybookGet the brief →
ReleaseInsight · On RadarAWS Machine Learning Blog→ original

Kiro Ports PHP Apps to Java in 8 Stages and Checks Them Against the Original

Moving a legacy PHP application to Java often breaks invisible business rules: the code compiles, but customers get different answers. AWS proposed an 8-stage process for the Kiro AI environment: a scanner describes the models, judge tests send identical requests to PHP and Java, and only then is code generated. The port is considered ready when both versions return matching answers. The approach suits any migration where the old system serves as the only specification.

AI-processed from AWS Machine Learning Blog; edited by Hamidun News
Kiro Ports PHP Apps to Java in 8 Stages and Checks Them Against the Original
Source: AWS Machine Learning Blog. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceAWS Machine Learning Blog ↗
Editor-in-Chief
Key metric #1The scanner reads the code as text and runs nothing
Key metric #2Judge tests are written before the Java code and must fail on a deliberate break
Key metric #3The example ports only 4 of 37 models, and no parity tests exist yet

Picture an old e-commerce application in PHP, written over the years with Laravel or Symfony. Some business rules, such as which fields to hide from the customer or how relationships between tables are counted, live not in obvious code but in Eloquent traits and XML mapping files. The team rewrites everything in Java for strict typing and predictable scaling.

The code compiles without errors, yet customers suddenly get different responses. In its blog, AWS showed how to deal with this using Kiro. It is an AI development environment (IDE) where an agent works with your repository and carries out multi-step tasks under human supervision.

The migration there is split into 8 stages, and readiness is determined not by a developer's feeling but by a test suite that compares the behavior of the old and new versions.

Inventory first, translation second

The main rule of the method: until the scanner has run, no model may be read, guessed at, or translated by hand. The scanner discover-models.php is a single PHP script with no dependencies. It does not run the target code; it parses the source files as text, so it works even where the project's dependencies are not installed.

It finds models in three ways: it walks the inheritance chain up to Eloquent Model, catches the Doctrine #[ORM\Entity] attribute, and reads external *.orm.xml files. The output is a single JSON manifest with all fields, type casts, relationships, and visibility rules. The scanner does not guess at anything uncertain; it places it in a queue of flags for a human. For example, if the $fillable list is built from an expression evaluated at runtime, a clear warning appears.

Eight stages and tests as the judge

The first stages require human expertise. Stage 0 runs the scanner and collects the inventory. Stage 1 builds a set of checks before a single line of Java is written: it sends identical request-response pairs to the PHP original and the Java port. This set must pass on working PHP and fail if deliberately broken. If the checks do not notice an introduced break, they cannot be trusted.

In stages 2 and 3, a translation rulebook (RULEBOOK.md) and a gap list (GAP_INVENTORY.md) are created and validated on typical files. Stages 4 through 8 then run mostly in automated loops:

  • a Spring Boot project skeleton;
  • translation of the data model into JPA entities;
  • translation of the input-output layer: routes become controllers, middleware becomes filters, and validation becomes annotated DTOs (data transfer objects);
  • batch conversion of business logic;
  • proof of parity, meaning matching behavior, and the switchover to the new version.

Two principles govern the work. The PHP code is treated as the specification: the port is ready when the judge tests agree, or else every discrepancy is recorded as an approved change. And second: fix the loop, not the code. If the same error repeats across files, the rulebook is corrected and the code is regenerated instead of patched by hand.

What the example showed, and its limits

The demonstration project laravel-eloquent-sample is a read-only slice of an open-source Laravel application. The models Book, Chapter, Page, and User were ported to Spring Boot 3.4.1, Java 21, Maven, and the in-memory H2 database. The correspondences are mechanical and traceable to the manifest: the PHP namespace becomes a Java package, the model becomes a JPA @Entity, the hasMany and belongsTo relationships become @OneToMany and @ManyToOne, and Eloquent scope queries become Spring Data repository methods. Care is also visible in the details: the html, markdown, and text fields are marked @JsonIgnore, because in Page they were listed in the $hidden array, while the Book description is intentionally left open.

The authors acknowledge the limitations themselves. Only 4 of the 37 models were ported, and a parity test suite was never built for this slice; the specification calls this the largest gap. In other words, the example illustrates the method but does not prove it on real production systems.

For scale there is a second path: AWS Transform, AWS's agentic service for large migrations, now integrates natively with Kiro. The same skill files (versioned Markdown packages php-to-java-migration and php-model-discovery) can be handed to it, and it will run the same method in parallel across many applications. Every fix to the rulebook made in Kiro improves the next run in AWS Transform, and vice versa. The method detects Laravel, Symfony, CodeIgniter, and plain PHP on its own, and supporting a new framework requires only adding a detection line and a reference file.

What to take from this

Even if you do not use Kiro, the scheme applies to any migration where the old system is the only complete specification. First, mechanically describe what you have. Then build a judge and confirm that it catches breaks. Only after that generate code, and fix recurring errors in the rules. The repository is open: to experiment you need PHP 8.0+ for the scanner and Java 21 with Maven for the generated projects.

Story

Key Questions Answered

What are the key details on Inventory first, translation second?

The main rule of the method: until the scanner has run, no model may be read, guessed at, or translated by hand. The scanner discover-models.php is a single PHP script with no dependencies. It does not run the target code; it parses the source files as text, so it works even where the project's dependencies are not installed. It finds models in three ways: it walks the inheritance chain up to Eloquent Model, catches the Doctrine #[ORM\Entity] attribute, and reads external .orm.xml files.

What are the key details on Eight stages and tests as the judge?

The first stages require human expertise. Stage 0 runs the scanner and collects the inventory. Stage 1 builds a set of checks before a single line of Java is written: it sends identical request-response pairs to the PHP original and the Java port. This set must pass on working PHP and fail if deliberately broken. If the checks do not notice an introduced break, they cannot be trusted.

What the example showed, and its limits?

The demonstration project laravel-eloquent-sample is a read-only slice of an open-source Laravel application. The models Book, Chapter, Page, and User were ported to Spring Boot 3.4.1, Java 21, Maven, and the in-memory H2 database. The correspondences are mechanical and traceable to the manifest: the PHP namespace becomes a Java package, the model becomes a JPA @Entity, the hasMany and belongsTo relationships become @OneToMany and @ManyToOne, and Eloquent scope queries become Spring Data repository methods.

ZK
Zhemal Khamidun — Head of AI at Alpina Digital · MIPT (academic supervisor of the Tech Entrepreneurship department). Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
Jemal Hamidun

Editor-in-chief · Cite this analysis

Jemal Hamidun

Head of AI at Alpina Digital · Academic Supervisor of the Tech Entrepreneurship Department at MIPT

Head of AI & CPO of AlpinaGPT at Alpina Digital, Academic Lead of Tech Entrepreneurship at MIPT. Founder of Hamidun News and Vibe Academy.

Ready-to-paste citation for journalists, blogs and Telegram channels

Source: Hamidun News — Kiro Ports PHP Apps to Java in 8 Stages and Checks Them Against the Original https://news.hamidun.com/en/news/16841/kiro-ports-php-apps-to-java-in-8-stages-and-checks-them-agai

What do you think?
Loading comments…