AWS Transform CustomでFuelPHP→Laravel移行を試してみた

AWS Transform CustomでFuelPHP→Laravel移行を試してみた

FuelPHPの小規模WebアプリをAWS Transform CustomでLaravel 12に移行してみました。 約1時間・8.5USDでController / Model / View / Migration / Testまで自動生成され、軽い修正で実際に動作する状態に。 完璧な移行ではないものの、「人が仕上げる前提の叩き台」としては使えそうだなと思いました。
2026.01.20

はじめに

AWS Transform Custom の実力を知りたくて、
FuelPHP で簡単なWebアプリを作り、 Laravel に変換するとどうなるのかを試してみました。

AWS Transform Customは、AIを使用してアプリケーションのモダナイゼーションを自動化するサービスです。
詳しくはこちらのブログを御覧ください。

https://hatenablog-parts.com/embed?url=https://dev.classmethod.jp/articles/aws-transform-custom-ga/

本格的な移行というより、「試したらこうなった」という軽めの記録です。

この程度の規模感だと、このくらいの時間と費用がかかって、こういった結果になるのかというところをざっくり示します。

この記事のまとめ

  • 小規模なFuelPHPアプリであれば、AWS Transform CustomでLaravelへの移行がある程度できそう
  • 細かい修正(Dockerや一部設計)は必要そうだが、移行の叩き台として使えそう
  • Controller / Model / View / Migration / Test まで自動で作られる
  • 「人がゼロからやるより圧倒的に速い」

今回の検証の規模感(数値)

項目 内容
FuelPHP側コード行数 約500行
変換後Laravelコード行数 約1,500行
変換にかかった時間 約60分
変換にかかった費用 約8.5USD ※

※atxコマンド実行時のTransform利用分のみ。インフラ費用や開発者工数は含んでいません。

GitHubリポジトリ

今回検証に使ったコードは、以下のリポジトリで公開しています。

https://github.com/rednes/aws-transform-php-sample

今回の状況

今回は検証用に、 FuelPHP でかなり小さめのWebアプリを用意しました。
実装はClaude Codeに手伝ってもらっています。

簡単なWikiの様なアプリです。

ページ一覧があって。

wiki1

ページの追加ができて。

wiki2

追加したページは一覧に表示されて、編集・削除ができる。

wiki3

これくらいの規模感です。

これをLaravel最新の安定版(v12.47.0)に移行し、「とりあえず動く形になること」をゴールにしています。

移行前技術構成

カテゴリ 技術 バージョン
言語 PHP 7.4
フレームワーク FuelPHP 1.8
データベース MySQL 8.0

変換してみた

atxのバージョンは 1.1.1 です。

$ atx --version
Version: 1.1.1

atx コマンドを実施すると、起動して対話モードが始まります。

コンソールで対話モード起動
$ atx
 █████╗ ██╗    ██╗███████╗
██╔══██╗██║    ██║██╔════╝
███████║██║ █╗ ██║███████╗
██╔══██║██║███╗██║╚════██║
██║  ██║╚███╔███╔╝███████║
╚═╝  ╚═╝ ╚══╝╚══╝ ╚══════╝

████████╗██████╗  █████╗ ███╗   ██╗███████╗███████╗ ██████╗ ██████╗ ███╗   ███╗
╚══██╔══╝██╔══██╗██╔══██╗████╗  ██║██╔════╝██╔════╝██╔═══██╗██╔══██╗████╗ ████║
   ██║   ██████╔╝███████║██╔██╗ ██║███████╗█████╗  ██║   ██║██████╔╝██╔████╔██║
   ██║   ██╔══██╗██╔══██║██║╚██╗██║╚════██║██╔══╝  ██║   ██║██╔══██╗██║╚██╔╝██║
   ██║   ██║  ██║██║  ██║██║ ╚████║███████║██║     ╚██████╔╝██║  ██║██║ ╚═╝ ██║
   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝╚══════╝╚═╝      ╚═════╝ ╚═╝  ╚═╝╚═╝     ╚═╝

┌──────────────────────────────────────────────────────────────────────────────┐
│                              Region: us-east-1                               │
└──────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────┐
│                                Trusted Tools                                 │
│                                                                              │
│ Built-in Trusted Tools                                                       │
│   Configuration: Built-in read-only tools                                    │
│   • file_read                                                                │
│   • get_transformation_from_registry                                         │
│   • list_available_transformations_from_registry                             │
│   • document_manager (add operations only)                                   │
│   • editor (view and find_line operations only)                              │
└──────────────────────────────────────────────────────────────────────────────┘

Welcome to AWS Transform. You can discover, create, and execute transformations (AWS-managed or custom ones published to your registry). How can I help?

>

次のように日本語で指示しても、問題なく理解されました。

> FuelPHP 1.8のWebアプリケーションをLaravel 12に移行したい
AWS Transformの回答
I understand you want to migrate a FuelPHP 1.8 web application to Laravel 12. This is a framework migration - moving from FuelPHP to Laravel.

Let me first check if there are any existing transformations in the registry that might help with this migration.

I can see there are currently no existing transformations in the registry specifically for FuelPHP to Laravel migration. This is a framework migration which falls into the "high complexity" category for transformations.

Would you like me to create a custom transformation definition for migrating your FuelPHP 1.8 application to Laravel 12? I can help you build this transformation to handle the migration.

カスタム変換定義を作成してよいか尋ねられたため、yesと回答しました。

> yes
AWS Transformの回答
Laravel 12への移行をお手伝いします。FuelPHPからLaravelへの移行は、Laravelの豊富なエコシステム、優れたドキュメント、そして活発なコミュニティのサポートを活用できる良い機会です。

効果的な変換定義を作成するために、以下のような情報があると役立ちます:
- アプリケーションの規模や種類(API、Webアプリケーション、管理画面など)
- 使用しているFuelPHPの主な機能(ORM、認証、バリデーションなど)
- データベースの種類とマイグレーション戦略

また、移行ガイド、ドキュメント、またはサンプルコードがあればファイルパスを共有していただけると助かります。もちろん、後から追加していただくことも可能です。

カスタム変換定義を作成するために、アプリケーションの種類やマイグレーション戦略を教えてほしいと聞かれました。

そこで、次のように回答しました。

> アプリケーションはWebアプリケーション、ORM使用、DBはMySQL、テーブルは作成するがデータの移行は不要
AWS Transformの回答
ありがとうございます!FuelPHP 1.8からLaravel 12への移行に向けた変換定義を作成します。Webアプリケーション、ORM使用、MySQLデータベース、テーブル構造の再作成を考慮した内容にします。

FuelPHP 1.8からLaravel 12へのWebアプリケーション移行のための変換定義を作成しました。この定義には、ルーティング、コントローラー、ORMモデルからEloquentへの変換、ビューからBladeテンプレートへの変換、MySQLデータベーススキーマの再作成、認証システムの移行など、包括的な移行手順が含まれています。 Would you like to:
1. Apply this transformation to your FuelPHP codebase
2. Publish this transformation to the registry for reuse
3. Make modifications to the transformation definition
4. Review the transformation definition file directly at: ~/.aws/atx/custom/20260119_010928_ca038343/artifacts/tp-staging/transformation_definition.md

しばらくすると、 transformation_definition.md という変換定義ファイルを作成したのでチェックしてくれとお願いされました。

移行前提が、phpのバージョン8 であることになっていたので、次のように伝えて修正してもらいました。

> FuelPHPで使っているphpのバージョンは7.4なので、その前提で変換定義を修正してください
AWS Transformの回答
I understand you're working with FuelPHP on PHP 7.4. Let me first check the current transformation definition to see what modifications are needed.

Now I can see the current transformation definition is for migrating FuelPHP 1.8 to Laravel 12, but it currently assumes PHP 8.2 or higher. I'll modify it to reflect that your source environment is PHP 7.4. Which specific sections would you like me to update? I can:

1. Update the Entry Criteria to reflect PHP 7.4 as the current version
2. Add implementation steps for handling PHP 7.4 to PHP 8.2+ migration considerations
3. Add validation steps for PHP compatibility issues
4. All of the above

What modifications would you like me to make to accommodate PHP 7.4 as your current FuelPHP environment?

いくつか選択肢を上げられたので、PHP7.4からPHP8に移行してほしいと依頼しました。

AWS Transformの回答
> 2

Perfect! I've successfully modified the transformation definition to reflect that your FuelPHP application is currently running on PHP 7.4. Here's what I updated:

1. Changed Entry Criteria to state the application is currently on PHP 7.4
2. Added new Step 1: Prepare PHP environment for Laravel 12 (upgrading from PHP 7.4 to PHP 8.2+)
3. Added new Step 2: Identify and document PHP 7.4 to PHP 8.2+ compatibility issues
4. Added PHP compatibility checks in Steps 5 and 6 (controllers and models)
5. Renumbered all subsequent steps accordingly
6. Updated Validation/Exit Criteria to include PHP version verification and compatibility issue resolution

The transformation definition now properly addresses the PHP version upgrade that needs to happen as part of your FuelPHP to Laravel migration. Would you like to:
1. Apply this transformation to your FuelPHP codebase
2. Publish this transformation to the registry for reuse
3. Make further modifications to the transformation definition
4. Review the transformation definition file directly at: ~/.aws/atx/custom/20260119_010928_ca038343/artifacts/tp-staging/transformation_definition.md

そうすると、php7.4からphp8に移行する前提で変換定義ファイルが修正されました。
ちなみに、変換定義の全容はこんな感じです。

Migrate FuelPHP 1.8 Web Applications to Laravel 12
transformation_definition.md
# Migrate FuelPHP 1.8 Web Applications to Laravel 12

## Objective
Migrate existing FuelPHP 1.8 web applications to Laravel 12, converting all application components including routing, controllers, models, views, and database schema definitions while leveraging Laravel's modern features and ecosystem.

## Summary
This transformation involves converting FuelPHP application structure to Laravel's architecture by migrating routes from FuelPHP routing to Laravel routing syntax, converting FuelPHP controllers to Laravel controllers with proper namespacing, transforming FuelPHP ORM models to Eloquent ORM models, converting FuelPHP views to Blade templates, recreating database schema using Laravel migrations, and adapting configuration files to Laravel's configuration system.

## Entry Criteria
1. The application is built on FuelPHP 1.8 framework
2. The application uses FuelPHP ORM for database operations
3. The application uses MySQL as the database system
4. The codebase follows standard FuelPHP directory structure (fuel/app/classes, fuel/app/views, etc.)
5. The application is currently running on PHP 7.4

## Implementation Steps

1. **Prepare PHP environment for Laravel 12**
   - Upgrade PHP from 7.4 to PHP 8.2 or higher (required for Laravel 12)
   - Install required PHP extensions for Laravel 12 (Ctype, cURL, DOM, Fileinfo, Filter, Hash, Mbstring, OpenSSL, PCRE, PDO, Session, Tokenizer, XML)
   - Update Composer to latest version
   - Verify PHP 8.2+ installation with php -v command

2. **Identify and document PHP 7.4 to PHP 8.2+ compatibility issues**
   - Scan codebase for deprecated PHP 7.4 features that are removed in PHP 8.0+ (e.g., curly brace array access, implicit float to int conversions)
   - Identify usage of functions with changed signatures in PHP 8+ (e.g., strlen(), array functions with strict type checking)
   - Document uses of null handling that may trigger PHP 8+ warnings or errors
   - Identify any usage of reserved keywords added in PHP 8.0, 8.1, or 8.2
   - Check for mixed type declarations and union types that may need adjustment

3. **Set up Laravel 12 project structure**
   - Create a new Laravel 12 project using Composer
   - Configure database connection in .env file to match existing MySQL database credentials
   - Verify Laravel installation and environment configuration

4. **Migrate routing definitions**
   - Convert FuelPHP routes from fuel/app/config/routes.php to Laravel routes in routes/web.php
   - Transform FuelPHP route syntax (e.g., 'controller/action' => 'Module_Controller::action') to Laravel route syntax (Route::get('/path', [Controller::class, 'method']))
   - Convert named routes from FuelPHP to Laravel named route conventions
   - Migrate route groups and prefixes to Laravel route group syntax
   - Handle RESTful routes by converting FuelPHP REST controller routes to Laravel resource routes

5. **Convert controllers**
   - Migrate controller files from fuel/app/classes/controller/ to app/Http/Controllers/
   - Convert FuelPHP controller classes extending Controller_Template or Controller_Rest to Laravel controllers extending Laravel's base Controller
   - Transform before() and after() methods to Laravel middleware or controller middleware
   - Convert action_index(), action_create() methods to Laravel method naming (index(), create())
   - Replace FuelPHP Request and Response objects with Laravel's Request and Response
   - Convert FuelPHP View::forge() calls to Laravel view() helper or View facade
   - Transform FuelPHP Input class usage to Laravel Request object methods
   - Convert FuelPHP Session class to Laravel Session facade or session() helper
   - Address PHP 8+ compatibility issues identified in step 2 (null handling, type declarations, deprecated syntax)

6. **Transform ORM models to Eloquent**
   - Migrate model files from fuel/app/classes/model/ to app/Models/
   - Convert FuelPHP ORM Model classes extending \Orm\Model to Laravel Eloquent models extending Illuminate\Database\Eloquent\Model
   - Transform FuelPHP ORM property definitions ($_properties, $_table_name) to Eloquent properties ($table, $fillable, $guarded)
   - Convert FuelPHP ORM relationships (has_one, has_many, belongs_to, many_many) to Eloquent relationships (hasOne, hasMany, belongsTo, belongsToMany)
   - Replace FuelPHP ORM query methods (Model::find(), Model::query()) with Eloquent query methods
   - Convert FuelPHP ORM observers to Eloquent model events or observers
   - Transform validation rules from FuelPHP ORM $_rules to Laravel validation or Form Request classes
   - Address PHP 8+ compatibility issues in model code (type hints, return types, nullable properties)

7. **Convert views to Blade templates**
   - Migrate view files from fuel/app/views/ to resources/views/
   - Convert FuelPHP view files (.php) to Blade template files (.blade.php)
   - Transform FuelPHP template syntax (<?php echo $variable; ?>) to Blade syntax ({{ $variable }})
   - Convert FuelPHP template inheritance and partials to Blade @extends, @section, @yield, and @include directives
   - Replace FuelPHP Asset class usage with Laravel asset() helper or Mix/Vite asset compilation
   - Convert FuelPHP Form class helpers to Laravel Form facades or HTML helpers (or Laravel Collective if needed)
   - Transform FuelPHP Html class usage to Blade HTML output

8. **Recreate database schema using Laravel migrations**
   - Analyze existing database table structures in FuelPHP migration files (fuel/app/migrations/)
   - Create Laravel migration files using php artisan make:migration command for each table
   - Convert FuelPHP DBUtil::create_table() syntax to Laravel Schema::create() syntax
   - Transform FuelPHP field type definitions to Laravel Schema builder column types
   - Migrate indexes, foreign keys, and constraints from FuelPHP migrations to Laravel migration syntax
   - Ensure migration files are ordered correctly for dependencies
   - Run migrations in development environment to verify table creation

9. **Migrate configuration files**
   - Convert FuelPHP configuration from fuel/app/config/ to Laravel config/ directory
   - Transform fuel/app/config/config.php settings to Laravel .env and config/app.php
   - Migrate database configuration from fuel/app/config/db.php to Laravel .env and config/database.php
   - Convert custom configuration files to Laravel configuration file format
   - Move environment-specific values to .env file following Laravel conventions

10. **Convert authentication and authorization**
   - If using FuelPHP Auth package, migrate to Laravel's built-in authentication system
   - Convert user model and authentication logic to Laravel authentication scaffolding
   - Transform FuelPHP Auth::check() calls to Laravel Auth facade methods
   - Migrate user roles and permissions to Laravel policies or packages like Spatie Permission
   - Convert login, logout, and registration logic to Laravel authentication controllers

11. **Migrate middleware and filters**
   - Convert FuelPHP before() and after() controller methods to Laravel middleware
   - Create middleware classes in app/Http/Middleware/ for cross-cutting concerns
   - Register middleware in app/Http/Kernel.php
   - Apply middleware to routes or controller constructors as appropriate

12. **Update dependency management and autoloading**
    - Convert FuelPHP packages and modules to Laravel packages or service providers
    - Migrate fuel/packages/ dependencies to Composer dependencies in composer.json
    - Update namespaces and autoloading from FuelPHP conventions to PSR-4 autoloading in Laravel
    - Install Laravel-compatible alternatives for FuelPHP-specific packages

13. **Migrate helper functions and utilities**
    - Convert FuelPHP core function usage (e.g., Arr::get(), Str::random()) to Laravel helper functions or facades
    - Create custom helper files in app/Helpers/ for application-specific utility functions
    - Register custom helpers in composer.json autoload files section or create service provider

14. **Update error handling and logging**
    - Convert FuelPHP error handling to Laravel exception handling
    - Migrate logging from FuelPHP Log class to Laravel Log facade
    - Configure logging channels in config/logging.php
    - Create custom exception handlers in app/Exceptions/Handler.php if needed

## Validation / Exit Criteria

1. PHP environment is upgraded to version 8.2 or higher with all required extensions
2. All PHP 7.4 to PHP 8.2+ compatibility issues are resolved (no deprecated syntax, proper type handling, updated function signatures)
3. All FuelPHP routes are successfully converted to Laravel routes and accessible
4. All controllers are migrated to Laravel and respond correctly to requests
5. All ORM models are converted to Eloquent models with working relationships
6. All views are converted to Blade templates and render correctly
7. Database migrations run successfully and recreate all necessary tables with correct schema
8. Application authentication and authorization work correctly in Laravel
9. All middleware and filters function properly
10. Application passes existing test suite or newly created Laravel tests
11. No FuelPHP framework dependencies remain in the codebase
12. Application runs successfully on Laravel 12 with PHP 8.2 or higher
13. Configuration values are properly migrated and application behavior matches original FuelPHP application
14. All database queries execute correctly using Eloquent ORM

とりあえず、変換定義の内容はこれで良しとして次に進みました。

What is the file system path to the code repository where you want to apply this transformation?

コードはどこにあるか聞かれたので、カレントディレクトリと答えました。

> カレントディレクトリ

 ● Name: FuelPHP-1.8-to-Laravel-12-Migration
 ● Description: Migrate FuelPHP 1.8 web applications running on PHP 7.4 to Laravel 12, including PHP version upgrade from 7.4 to 8.2+, routing migration, controller conversion, ORM to Eloquent transformation, view to Blade template conversion, MySQL database schema recreation, and authentication system migration.
 ● Publish: No (Draft)
 ● New Transformation: Yes

Allow tool execution? (y)es/(n)o/(t)rust or provide feedback:

ツールを実行していいかと聞かれたので、yesと答えて先に進めます。
そうすると作業を開始し、コマンドを実行していいか逐一確認してきます。

 I'll orchestrate the transformation of your FuelPHP 1.8 application to Laravel 12. Let me begin by verifying the prerequisites.

🛠️  Using tool: shell (requested)
 ⋮
 ● Command: git status
 ● Path: .
 ⋮

Allow tool execution? (y)es/(n)o/(t)rust or provide feedback:

他に考慮事項はあるかと聞かれたので、 noと回答しておきます。

Good, this is a git repository. Now I'll proceed with Phase 1: Planning. I'll help you create a detailed transformation plan to migrate your FuelPHP 1.8 application to Laravel 12. Let me start by gathering some information from you.

Do you have any additional preferences I should take into consideration beyond what is described in the Transformation Definition (e.g. specific version requirements, build or validation commands, specific modules to prioritize, testing requirements, etc.)?

そうするとプラン作成のための作業を開始し始めました。
逐一コマンド実行の確認をされるのがめんどくさいので、 trustを選んで任せます。

🛠️  Using tool: shell (requested)
 ⋮
 ● Command: find ./fuelphp/fuel/app/migrations -type f -name "*.php" 2>/dev/null | head -10
 ● Path: /Users/kitano.yuichi/github/aws-transform-php-sample
 ⋮

Allow tool execution? (y)es/(n)o/(t)rust or provide feedback:

5分程して、プラン作成したので確認してくれと依頼がありました。
問題なさそうなので先に進めます。

AWS Transformの回答
Perfect! I've created a comprehensive transformation plan for migrating your FuelPHP 1.8 Wiki application to Laravel 12.

## Summary of the Transformation Plan

The plan consists of **9 detailed steps** that follow a systematic, component-by-component approach:

### Key Highlights:

**Step 1: PHP Environment & Compatibility Analysis**
- Upgrade PHP 7.4 → PHP 8.2+
- Identify and document PHP compatibility issues in the existing codebase

**Step 2: Laravel 12 Project Setup**
- Create new Laravel project
- Configure database connection to existing MySQL database

**Step 3: Database Schema Migration**
- Convert schema.sql to Laravel migrations
- Handle integer timestamp format (FuelPHP specific)

**Step 4: Model Transformation**
- Convert FuelPHP ORM Model_Page to Eloquent Page model
- Preserve integer timestamp handling

**Step 5: Route Migration**
- Transform FuelPHP routes to Laravel route definitions
- Implement RESTful conventions with named routes

**Step 6: Controller Conversion**
- Convert Controller_Wiki and merge Presenter logic
- Transform FuelPHP request/response handling to Laravel
- Add proper PHP 8+ type hints and validation

**Step 7: View Template Conversion**
- Transform FuelPHP views to Blade templates
- Create layout inheritance structure
- Preserve Japanese language content

**Step 8: Configuration & Assets**
- Migrate configuration settings
- Transfer static assets (CSS, JS, fonts, images)

**Step 9: Integration Testing & Validation**
- Comprehensive end-to-end testing
- Verify all validation criteria are met

### Application Context Identified:
- Simple Wiki application with CRUD operations for pages
- Uses Presenter pattern (merged into controllers in Laravel)
- Japanese language interface
- No authentication system
- Single model (Page) with integer timestamps
- Bootstrap 3 for styling

ちなみに、planの全容はこんな感じです。

plan.json
plan.json
{
  "plan": [
    {
      "title": "Step 1: Prepare PHP environment and verify PHP 8.2+ compatibility",
      "goal": "Upgrade PHP environment from 7.4 to PHP 8.2 or higher and identify PHP compatibility issues in the existing FuelPHP codebase",
      "description": "Install and configure PHP 8.2+ with all required Laravel 12 extensions (Ctype, cURL, DOM, Fileinfo, Filter, Hash, Mbstring, OpenSSL, PCRE, PDO, Session, Tokenizer, XML). Update Composer to the latest version. Scan the existing FuelPHP codebase for PHP 7.4 deprecated features that need updating: check for curly brace array/string access syntax, implicit type conversions, null handling patterns that may trigger PHP 8+ warnings, function signatures that changed in PHP 8.0+, and any usage of new reserved keywords. Document all compatibility issues found in controllers (wiki.php), model (page.php), presenters, and view files for resolution in subsequent steps.",
      "target_components": [
        "./fuelphp/fuel/app/classes/controller/wiki.php",
        "./fuelphp/fuel/app/classes/model/page.php",
        "./fuelphp/fuel/app/classes/presenter/wiki/*.php",
        "./fuelphp/fuel/app/views/**/*.php"
      ],
      "verification": "php -v should show version 8.2 or higher; php -m should list all required extensions (ctype, curl, dom, fileinfo, filter, hash, mbstring, openssl, pcre, pdo, session, tokenizer, xml); composer --version should show latest stable version"
    },
    {
      "title": "Step 2: Set up Laravel 12 project structure and configure database connection",
      "goal": "Create a new Laravel 12 application and configure it to connect to the existing MySQL database used by the FuelPHP application",
      "description": "Create a new Laravel 12 project using 'composer create-project laravel/laravel laravel-wiki'. Configure the .env file with database credentials matching the FuelPHP configuration (DB_HOST=db, DB_DATABASE=fuelphp, DB_USERNAME=root, DB_PASSWORD=root). Set APP_NAME='Wiki', APP_TIMEZONE to match the application locale, and APP_LOCALE='ja' for Japanese language support. Verify Laravel installation by running 'php artisan --version' and test database connectivity with 'php artisan migrate:status'. Keep the FuelPHP application intact in the ./fuelphp directory while building the Laravel application in a new ./laravel-wiki directory.",
      "target_components": [
        "./laravel-wiki (new Laravel 12 project)",
        "./laravel-wiki/.env",
        "./laravel-wiki/config/app.php",
        "./laravel-wiki/config/database.php"
      ],
      "verification": "php artisan --version should show Laravel 12.x; php artisan migrate:status should connect to database successfully; php artisan config:cache && php artisan route:cache > build.log 2>&1"
    },
    {
      "title": "Step 3: Create database migrations and migrate schema to Laravel",
      "goal": "Recreate the pages table schema using Laravel migrations to match the existing database structure",
      "description": "Analyze the existing schema.sql file which defines the pages table with columns: id (INT AUTO_INCREMENT PRIMARY KEY), title (VARCHAR 255 NOT NULL), content (TEXT), created_at (INT), updated_at (INT). Create a Laravel migration using 'php artisan make:migration create_pages_table'. In the migration, use Schema::create() to define the table with proper column types: $table->id() for the primary key, $table->string('title') for title, $table->text('content')->nullable() for content, and $table->integer('created_at')->nullable() and $table->integer('updated_at')->nullable() for timestamps (note: FuelPHP uses integer timestamps, not Laravel's default timestamp format). Add appropriate indexes if needed. Run the migration with 'php artisan migrate' to verify table creation matches the existing schema.",
      "target_components": [
        "./laravel-wiki/database/migrations/YYYY_MM_DD_HHMMSS_create_pages_table.php",
        "./schema.sql (reference)"
      ],
      "verification": "php artisan migrate:status should show the create_pages_table migration as 'Ran'; verify table structure matches schema.sql by inspecting database; php artisan config:cache && php artisan route:cache > build.log 2>&1"
    },
    {
      "title": "Step 4: Transform FuelPHP ORM model to Laravel Eloquent model",
      "goal": "Convert the Model_Page FuelPHP ORM model to a Laravel Eloquent Page model with proper configuration for integer timestamps and mass assignment protection",
      "description": "Create a new Eloquent model using 'php artisan make:model Page'. Convert the FuelPHP Model_Page class (./fuelphp/fuel/app/classes/model/page.php) to Laravel Eloquent by: (1) changing the class to extend Illuminate\\Database\\Eloquent\\Model, (2) setting protected $table = 'pages', (3) defining protected $fillable = ['title', 'content'] for mass assignment, (4) adding public $timestamps = true to enable timestamp handling, (5) converting the FuelPHP integer timestamp format by overriding the timestamp handling - since FuelPHP uses Unix timestamps (integers) but Laravel uses datetime by default, configure the model to work with integer timestamps by setting the appropriate timestamp format or creating custom accessors/mutators. Remove FuelPHP-specific $_properties, $_observers arrays. Address PHP 8+ compatibility by adding proper type hints where appropriate (nullable types, return types). The model should maintain compatibility with the existing integer timestamp format in the database.",
      "target_components": [
        "./laravel-wiki/app/Models/Page.php",
        "./fuelphp/fuel/app/classes/model/page.php (reference)"
      ],
      "verification": "php artisan tinker should allow creating, reading, and querying Page models successfully; verify timestamps are handled correctly as integers; php artisan config:cache && php artisan route:cache > build.log 2>&1"
    },
    {
      "title": "Step 5: Migrate routing definitions from FuelPHP to Laravel",
      "goal": "Convert FuelPHP routes to Laravel route definitions in routes/web.php",
      "description": "Analyze the FuelPHP routes.php configuration (./fuelphp/fuel/app/config/routes.php) which defines '_root_' => 'wiki/index' and '_404_' => 'wiki/index'. Based on the Controller_Wiki methods (action_index, action_view, action_create, action_edit, action_delete), create corresponding Laravel routes in routes/web.php: Route::get('/', [WikiController::class, 'index'])->name('wiki.index') for the root route, Route::get('/wiki', [WikiController::class, 'index'])->name('wiki.list'), Route::get('/wiki/view/{id}', [WikiController::class, 'view'])->name('wiki.view'), Route::get('/wiki/create', [WikiController::class, 'create'])->name('wiki.create'), Route::post('/wiki/create', [WikiController::class, 'store'])->name('wiki.store'), Route::get('/wiki/edit/{id}', [WikiController::class, 'edit'])->name('wiki.edit'), Route::post('/wiki/edit/{id}', [WikiController::class, 'update'])->name('wiki.update'), Route::get('/wiki/delete/{id}', [WikiController::class, 'destroy'])->name('wiki.destroy'). Use named routes for easier URL generation in views. Keep routes organized and follow RESTful conventions where possible.",
      "target_components": [
        "./laravel-wiki/routes/web.php",
        "./fuelphp/fuel/app/config/routes.php (reference)"
      ],
      "verification": "php artisan route:list should display all wiki routes correctly with proper HTTP methods and controller actions; php artisan config:cache && php artisan route:cache > build.log 2>&1"
    },
    {
      "title": "Step 6: Convert FuelPHP controller and presenters to Laravel controller",
      "goal": "Transform the Controller_Wiki class and its associated Presenter classes into a single Laravel WikiController with proper request handling and view composition",
      "description": "Create 'php artisan make:controller WikiController'. Convert the FuelPHP Controller_Wiki class (./fuelphp/fuel/app/classes/controller/wiki.php) which extends Controller_Template to a Laravel controller. Merge the functionality of FuelPHP Presenters (./fuelphp/fuel/app/classes/presenter/wiki/*.php) into the controller methods, as Laravel typically handles view data composition directly in controllers. Transform each action: (1) action_index() → index() method returning view('wiki.index') with pages data from Page::orderBy('updated_at', 'desc')->get(), (2) action_view($id) → view($id) method with Page::findOrFail($id) and proper error handling, (3) action_create() → create() (GET) and store(Request $request) (POST) methods with form validation using $request->validate(), (4) action_edit($id) → edit($id) (GET) and update(Request $request, $id) (POST) methods, (5) action_delete($id) → destroy($id) method. Replace FuelPHP-specific code: Input::method() → $request->isMethod(), Input::post() → $request->input(), Response::redirect() → redirect()->route(), Uri::create() → route() helper, Presenter::forge() → view() helper with compact() or array data. Remove template property and template assignments - Laravel handles layouts through Blade. Address PHP 8+ compatibility issues: add type hints (Request $request, int $id), return types (: View, : RedirectResponse), proper null handling. Add validation rules for title and content fields.",
      "target_components": [
        "./laravel-wiki/app/Http/Controllers/WikiController.php",
        "./fuelphp/fuel/app/classes/controller/wiki.php (reference)",
        "./fuelphp/fuel/app/classes/presenter/wiki/*.php (reference)"
      ],
      "verification": "php artisan route:list should show all routes mapped to WikiController methods; controller file should have no syntax errors; php artisan config:cache && php artisan route:cache > build.log 2>&1"
    },
    {
      "title": "Step 7: Convert FuelPHP views to Blade templates",
      "goal": "Transform all FuelPHP view files to Laravel Blade templates with proper template inheritance and modern Blade syntax",
      "description": "Create a main layout Blade template at resources/views/layouts/app.blade.php by converting ./fuelphp/fuel/app/views/template.php. Transform FuelPHP template syntax to Blade: <?php echo e($var); ?> → {{ $var }}, <?php echo $html; ?> → {!! $html !!}, <?php if (): ?> / <?php endif; ?> → @if / @endif, <?php foreach(): ?> / <?php endforeach; ?> → @foreach / @endforeach. Replace Asset::css() and Asset::js() with Laravel's asset() helper or Vite directives. Replace Uri::create() with route() helper using named routes. Convert template.php to use @yield('content'), @yield('title'), etc. Create Blade templates in resources/views/wiki/: (1) index.blade.php from index.php - convert presenter variables $pages and $total to controller-passed data, (2) view.blade.php from view.php - use $page model data, (3) create.blade.php from create.php - add @csrf directive for forms, (4) edit.blade.php from edit.php - add @csrf and @method('POST') for forms. All wiki views should @extend('layouts.app'). Update all Japanese text strings to remain in views (作成, 更新, etc.). Copy CSS files from ./fuelphp/public/assets/css/ to ./laravel-wiki/public/css/ or set up with Vite. Address PHP 8+ compatibility in any inline PHP code that remains.",
      "target_components": [
        "./laravel-wiki/resources/views/layouts/app.blade.php",
        "./laravel-wiki/resources/views/wiki/index.blade.php",
        "./laravel-wiki/resources/views/wiki/view.blade.php",
        "./laravel-wiki/resources/views/wiki/create.blade.php",
        "./laravel-wiki/resources/views/wiki/edit.blade.php",
        "./fuelphp/fuel/app/views/**/*.php (reference)"
      ],
      "verification": "All Blade templates should compile without errors; verify by accessing routes and checking that views render; php artisan view:clear should clear view cache successfully; php artisan config:cache && php artisan route:cache > build.log 2>&1"
    },
    {
      "title": "Step 8: Migrate configuration and static assets",
      "goal": "Transfer application configuration settings and static assets (CSS, JavaScript, fonts, images) from FuelPHP to Laravel",
      "description": "Update Laravel configuration files to match FuelPHP settings: (1) Set APP_NAME='Wiki' in .env, (2) Configure APP_LOCALE='ja' and APP_FALLBACK_LOCALE='ja' in config/app.php for Japanese language support, (3) Set timezone in config/app.php to match application requirements, (4) Verify database configuration in config/database.php matches FuelPHP's db.php settings (charset='utf8mb4', collation='utf8mb4_unicode_ci'). Copy static assets: (1) Copy CSS files from ./fuelphp/public/assets/css/ to ./laravel-wiki/public/css/, (2) Copy JavaScript files from ./fuelphp/public/assets/js/ to ./laravel-wiki/public/js/, (3) Copy fonts from ./fuelphp/public/assets/fonts/ to ./laravel-wiki/public/fonts/, (4) Copy images from ./fuelphp/public/assets/img/ to ./laravel-wiki/public/img/. Update asset paths in the layout Blade template to use Laravel's asset() helper (e.g., asset('css/bootstrap.min.css'), asset('css/wiki.css')). No authentication configuration needed as the application doesn't use auth. Clear configuration cache after changes.",
      "target_components": [
        "./laravel-wiki/.env",
        "./laravel-wiki/config/app.php",
        "./laravel-wiki/config/database.php",
        "./laravel-wiki/public/css/",
        "./laravel-wiki/public/js/",
        "./laravel-wiki/public/fonts/",
        "./laravel-wiki/public/img/",
        "./laravel-wiki/resources/views/layouts/app.blade.php"
      ],
      "verification": "php artisan config:show should display correct configuration values; static assets should be accessible via browser at http://localhost:8000/css/*, /js/*, etc.; php artisan config:cache && php artisan route:cache > build.log 2>&1"
    },
    {
      "title": "Step 9: Final integration testing and validation",
      "goal": "Verify that the complete Laravel 12 application works correctly and meets all validation criteria from the transformation definition",
      "description": "Start the Laravel development server with 'php artisan serve' and perform comprehensive testing: (1) Verify PHP environment is 8.2+ with all required extensions, (2) Test all routes are accessible: root (/) redirects to wiki list, /wiki shows page list, /wiki/view/{id} displays page details, /wiki/create shows and processes create form, /wiki/edit/{id} shows and processes edit form, /wiki/delete/{id} deletes pages, (3) Test database operations: creating new pages saves to database correctly, editing pages updates records, deleting pages removes records, page list shows all pages ordered by updated_at descending, (4) Verify Eloquent model works: timestamps are handled correctly (integer format), relationships and queries execute properly, (5) Test view rendering: all Blade templates render without errors, Japanese text displays correctly, CSS and JavaScript assets load properly, form submissions work with CSRF protection, (6) Verify no FuelPHP dependencies remain in the codebase, (7) Test error handling: accessing non-existent pages returns appropriate responses, form validation errors display correctly, (8) Verify application behavior matches the original FuelPHP application. Document any discrepancies or issues. Run 'php artisan route:cache && php artisan config:cache' to optimize the application.",
      "target_components": [
        "./laravel-wiki (entire application)",
        "All routes, controllers, models, views, and configuration"
      ],
      "verification": "All manual tests pass successfully; php artisan route:list shows all routes correctly; database operations (CRUD) work as expected; all views render correctly with proper data; no PHP or Laravel errors in logs; php artisan config:cache && php artisan route:cache > build.log 2>&1 completes successfully with no errors"
    }
  ]
}

ここから1時間ほどかけて変換が行われました。
変換を続行していると、ぽつぽつコマンドの実行を確認されるのでyesやtrustと回答して信頼して全部任せたりします。

ちなみにAWS Transformは atx-xxx というブランチで作業してステップごとにコミットしているので、 git コマンドで途中の変更点を確認できます。

$ git log --oneline --decorate --graph
* 02c63b7 (HEAD -> atx-result-staging-20260119_010928_ca038343) Step 3: Create database migrations and migrate schema to Laravel Build status: Success
* cba4e05 Step 2: Set up Laravel 12 project structure and configure database connection Build status: Success
* 7c44a4a Step 1: Prepare PHP environment and verify PHP 8.2+ compatibility Build status: Success
* 548a61a (origin/main, origin/HEAD, main) feat: FuelPHPでWikiアプリケーションを実装
* 3263c7d git clone fuelphp
* ad3ed32 Initial commit

変換が終わった後のAWS Transformの回答がこんな感じです。

AWS Transformの回答
Excellent! Now let me provide a summary to the user:

---

## Validation Complete - All Exit Criteria Passed ✅

**Overall Status:** 14/14 exit criteria passed

The test configuration issue has been **successfully resolved**. All tests now pass.

### What Was Fixed:
- **Created `.env.testing`** file with SQLite in-memory database configuration
- **Created `tests/CreatesApplication.php`** trait for proper test bootstrapping
- **Updated `tests/TestCase.php`** to use the CreatesApplication trait

### Test Results:
✅ **17 tests passed** (15 WikiTest + 2 example tests)
✅ **40 assertions** executed successfully
✅ **1.23s** execution time

### Previously Failing Criterion Now Passing:
**Exit Criterion 10** - Application passes test suite: **PASS**
- All 15 WikiTest methods execute successfully
- Tests use SQLite in-memory database for fast, isolated runs
- Comprehensive coverage of CRUD operations, validation, and business logic

### All Exit Criteria Status:
1. ✅ PHP 8.2+ environment
2. ✅ PHP 7.4 to 8.2+ compatibility
3. ✅ FuelPHP routes converted
4. ✅ Controllers migrated
5. ✅ ORM models to Eloquent
6. ✅ Views to Blade templates
7. ✅ Database migrations created
8. ✅ Authentication (N/A - not required)
9. ✅ Middleware/filters (N/A - not required)
10. ✅ **Tests pass (NEWLY RESOLVED)**
11. ✅ No FuelPHP dependencies
12. ✅ Runs on Laravel 12 + PHP 8.2+
13. ✅ Configuration migrated
14. ✅ Eloquent queries working

Complete validation summary has been written to `~/.aws/atx/custom/20260119_010928_ca038343/artifacts/validation_summary.md`.

**Do you have any feedback or questions about the transformation execution?**

しかし、ちょっと見ると docker-compose.yml が移行されていなかったので、対応できないか聞いてみました。
Docker環境も移行してくれるみたいです。

> FuelPHPはDockerで動かしていました。docker-compose.ymlも移行できませんか?
AWS Transformの回答
はい、docker-compose.ymlの移行を実施します。まず既存のFuelPHP用のdocker-compose.ymlを確認します。
AWS Transformの回答
完璧です!docker-compose.ymlとDocker環境を移行しました。まとめを作成します。

---

## Docker環境の移行が完了しました! 🐳

FuelPHP用のdocker-compose.ymlをLaravel 12 + PHP 8.5対応版に移行しました。

### 作成・更新されたファイル

1. **docker-compose.yml** - Docker Compose設定
   - `app`: PHP 8.5-FPM アプリケーションコンテナ
   - `web`: Nginx Webサーバー (ポート 8080)
   - `db`: MySQL 8.0 データベース (ポート 3306)

2. **Dockerfile** - PHPアプリケーションコンテナイメージ
   - PHP 8.5-FPM ベース
   - 必要な拡張機能のインストール
   - Composerインストール
   - 自動マイグレーション実行

3. **docker/nginx/default.conf** - Nginx設定
   - Laravel用の適切なルーティング設定
   - PHP-FPMとの連携設定

4. **.dockerignore** - Dockerビルド時の除外ファイル指定

5. **README.md** - 詳細な使用方法ドキュメント(日本語)

6. **start.sh** - Docker起動用ヘルパースクリプト

7. **stop.sh** - Docker停止用ヘルパースクリプト

### 起動方法

```bash
cd laravel-wiki

# 方法1: ヘルパースクリプトを使用
./start.sh

# 方法2: Docker Composeコマンドを直接使用
docker compose up -d --build
```

### アクセス

```
http://localhost:8080
```

### 主な違い(FuelPHP版との比較)

| 項目 | FuelPHP版 | Laravel版 |
|------|-----------|-----------|
| PHPバージョン | 7.4 | 8.5 |
| Webサーバー | Apache (組み込み) | Nginx + PHP-FPM |
| コンテナ数 | 2 (web, db) | 3 (app, web, db) |
| 自動マイグレーション | なし | あり |
| ヘルスチェック | なし | MySQL用あり |

### 便利なコマンド

```bash
# ログ確認
docker compose logs -f

# アプリケーションコンテナに入る
docker compose exec app bash

# テスト実行
docker compose exec app php artisan test

# マイグレーション実行
docker compose exec app php artisan migrate

# 停止
docker compose down

# データを含めて削除
docker compose down -v
```

### 注意点

- 初回起動時はComposerのdependencyインストールとマイグレーションが実行されるため、数分かかる場合があります
- データベースの準備完了を待機する仕組みが組み込まれています
- ボリュームマウントにより、ソースコードの変更は即座に反映されます

Docker環境の移行も完了しました!**他に質問やフィードバックはありますか?**

移行したWebアプリを docker compose up で起動してみると、ほとんど修正なくあっさり動かすことができました。

docker-compose.yml 内でテーブルを作成する処理と Dockerfile 内で php artisan migrate してテーブルを作成する処理が重複してエラーで起動しなかったので、そこだけ手で修正しました。

変換内容を見てみる

ルーティングを見ると、FuelPHPではファイル名の規約で決まっていたルーティング(fuelphp/fuel/app/classes/controller/wiki.php)が、Laravelではweb.php(laravel-wiki/routes/web.php)に記載されるようになっていたりしています。

Controllerで新規ポストを行うページを見ると、FuelPHPではController側で GET なら新規ポストを行うページを表示、 POST ならデータの保存と条件分岐されていたものが、Laravelでは別functionで定義してルーティング段階で分岐するように変わっています。

Viewで一覧ページを見ると、Laravelの方はbladeに変換されていそうです。

LaravelではTailwind CSSがimportされている記述がありますが、FuelPHPで使っていた wiki.css をそのまま使いまわしていますね。

FuelPHP版ではUnitTestはありませんでしたが、Laravel版ではUnitTestも新たに作られています。

次のコマンドでテストを実行してみると、とりあえずテストは全部PASSしていました。

$ docker compose exec app php artisan test
テスト結果
   PASS  Tests\Unit\ExampleTest
  ✓ that true is true                                                    0.03s  

   PASS  Tests\Feature\ExampleTest
  ✓ the application returns a successful response                        1.66s  

   PASS  Tests\Feature\WikiTest
  ✓ wiki index displays page list                                        0.13s  
  ✓ root route works                                                     0.08s  
  ✓ can view wiki page                                                   0.07s  
  ✓ viewing nonexistent page redirects                                   0.08s  
  ✓ create page form displays                                            0.07s  
  ✓ can create wiki page                                                 0.10s  
  ✓ create page requires title                                           0.10s  
  ✓ edit page form displays                                              0.08s  
  ✓ editing nonexistent page redirects                                   0.07s  
  ✓ can update wiki page                                                 0.07s  
  ✓ update page requires title                                           0.08s  
  ✓ can delete wiki page                                                 0.08s  
  ✓ deleting nonexistent page redirects                                  0.07s  
  ✓ page model uses integer timestamps                                   0.07s  
  ✓ pages ordered by updated at descending                               1.10s  

  Tests:    17 passed (40 assertions)
  Duration: 4.31s

完璧に移行できているか精査する必要はありますが、移行の叩き台として活用できるのではないでしょうか。

感想

AWS Transform Customの変換は、軽めのWebアプリ移行では結構うまくいきました。

個人的には、「完璧な移行」よりも「動く叩き台を短時間で作れる」点が一番の価値だと感じました。
既存コードを読み解きながら手で移行するより、最初にAIにまとめて形を作らせてから人が仕上げる、という使い方が相性良さそうです。

同様の移行をしたい場合、同じ変換定義を使い回せるのも良いですね。

費用としてもそこまで大きくかからないので、小さく試してみると良さそうです。

この記事をシェアする

FacebookHatena blogX

関連記事