Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.
Rust agent-skillsclaude-codeclicode-migrationcodexffigolangjavajavascriptmcpmigrationnapiperformanceportingpyo3pythonrewriterubyrusttypescript
analyze: propose Laravel Rust as the destination for Laravel apps (#1488)
Bora Ata Türkoğlu3bdd462f8608
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e4f0a4a3..3f76c077 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,12 @@## Unreleased+- `analyze` maps `laravel/framework` to Laravel Rust (`laravel-rust`, beta), with fit `partial`.+ Units that import `Illuminate\...` are no longer Blocked with "`laravel/framework` has no Rust+ equivalent". `analyze --whole-app` on an app whose `composer.json` requires `laravel/framework`+ asks whether to port to Laravel Rust or to a plain axum app, and recommends Laravel Rust, pinned+ to an exact 0.x version, with every route recorded first. Slim, Symfony, Laminas, CakePHP and Yii+ still map to axum with fit `none` (#1486).- PHP: `sys_get_temp_dir()`, `getmypid()`, `getmyuid()`, `get_current_user()` and `php_uname()`count as reading the environment, as `getcwd()` and `gethostname()` do, so `bridge` keeps afunction that calls one in PHP and `analyze` lists it under "State outside the arguments" (#1448).diff --git a/DECISIONS.md b/DECISIONS.mdindex 435056b1..6060e318 100644--- a/DECISIONS.md+++ b/DECISIONS.md@@ -27,6 +27,7 @@ Choices made so far, with reasons. Each one can be revisited.| A8 | Priority = half readiness, half value (loops and string work per line, tests, size between 80 and 600 lines). | Readiness alone picks trivial declaration files. A first port should be safe and worth the bridge. || A9 | The library-to-crate table (`src/crates.toml`, every language) is hand-curated; unknown packages are reported as `unknown`, never guessed. | The prompt: flag missing equivalents instead of hand-rolling silently. || A10 | JSON output carries `schema: rust-anything/analyze@1`. | Agents read it; it is a wire contract and gets versioned. |+| A11 | `laravel/framework` maps to `laravel-rust` with fit `partial`, and `--whole-app` on a Laravel app proposes Laravel Rust over plain axum; the other PHP web frameworks stay `axum` with fit `none`. | Laravel Rust (beta since December 2026) keeps the app's routes, models, jobs and mail in Laravel's shape, so the plan names a destination instead of "no Rust equivalent". It is 0.x, hence `partial` and an exact version pin. The other frameworks have no such counterpart. |## The loopdiff --git a/docs/faq.md b/docs/faq.mdindex 7dfa75ee..f0f008d6 100644--- a/docs/faq.md+++ b/docs/faq.md@@ -98,6 +98,13 @@ is what moves well.it is. Moving the UI to Tauri (the same web UI on a Rust backend) is a separate step once the logicis Rust.+**Can it port my Laravel app?** It plans the move and checks it; it does not write the Laravel Rust+code for you. `analyze --whole-app` sees `laravel/framework` in `composer.json` and proposes+[Laravel Rust](https://laravel.com/rust) (the `laravel-rust` crate, beta), which keeps routes,+middleware, models, validation, jobs and mail in Laravel's shape on axum. Record every route of the+PHP app first (`app record --http`), so each route the Rust app serves is checked against the+original. Pin an exact 0.x version: the API may change before 1.0.+**What about C#, Kotlin or Swift?** C# is verified for units of `public static` methods throughP/Invoke and supported for whole apps, Kotlin is tested for Gradle modules oftop-level functions and `@JvmStatic` methods (and Android JNI; see [Languages](languages.md#languages)),diff --git a/src/crates.rs b/src/crates.rsindex b0398144..582d0bdc 100644--- a/src/crates.rs+++ b/src/crates.rs@@ -416,6 +416,26 @@ mod tests {);}+ #[test]+ fn laravel_maps_to_laravel_rust_and_other_php_frameworks_stay_rewrites() {+ let laravel = find("php", "laravel/framework").unwrap();+ assert_eq!(+ (laravel.crates, laravel.fit),+ ("laravel-rust", Fit::Partial)+ );+ assert!(laravel.note.contains("beta"), "{}", laravel.note);+ for name in [+ "slim/slim",+ "symfony/framework-bundle",+ "laminas/laminas-mvc",+ "cakephp/cakephp",+ "yiisoft/yii2",+ ] {+ let m = find("php", name).unwrap_or_else(|| panic!("php: {name}"));+ assert_eq!((m.crates, m.fit), ("axum", Fit::None), "php: {name}");+ }+ }+#[test]fn python_service_libraries_map_or_are_kept() {for (name, crates, fit) in [diff --git a/src/crates.toml b/src/crates.tomlindex cf783bfc..d3db491e 100644--- a/src/crates.toml+++ b/src/crates.toml@@ -1006,7 +1006,13 @@ crates = "redis"fit = "good"[[php]]-names = ["laravel/framework", "slim/slim", "symfony/framework-bundle", "laminas/laminas-mvc", "cakephp/cakephp", "yiisoft/yii2"]+names = ["laravel/framework"]+crates = "laravel-rust"+fit = "partial"+note = "Laravel Rust (beta, 0.x: the API may change before 1.0) has routes, middleware, models, validation, queues, mail and auth; moving to it is still a whole-app rewrite"++[[php]]+names = ["slim/slim", "symfony/framework-bundle", "laminas/laminas-mvc", "cakephp/cakephp", "yiisoft/yii2"]crates = "axum"fit = "none"note = "a web framework is an application rewrite, not a port"diff --git a/src/whole_app.rs b/src/whole_app.rsindex 299e5a72..e7e87371 100644--- a/src/whole_app.rs+++ b/src/whole_app.rs@@ -534,6 +534,19 @@ pub fn whole_app(root: &Path, report: &Report) -> WholeApp {.into(),);}+ if lang == Lang::Php && declared.contains("laravel/framework") {+ ask(+ "framework".into(),+ "This is a Laravel app. Laravel Rust (the `laravel-rust` crate, beta) keeps its \+ routes, middleware, models, validation, jobs and mail in Laravel's shape, on axum. \+ Port to Laravel Rust, or to a plain axum app?"+ .into(),+ "Laravel Rust, pinned to an exact 0.x version, since its API may change before 1.0. \+ Record every route of the PHP app first (`app record --http`), so each route the \+ Rust app serves is checked against the original"+ .into(),+ );+ }for unit in report.units.iter().filter(|u| u.status == Status::Keep) {ask(format!("keep {}", unit.id),diff --git a/tests/analyze.rs b/tests/analyze.rsindex 05a4a55d..a0b8dd48 100644--- a/tests/analyze.rs+++ b/tests/analyze.rs@@ -811,6 +811,88 @@ fn electron_apps_get_a_main_process_decision() {assert!(shell.recommendation.contains("Tauri"), "{shell:?}");}+fn php_app(name: &str, framework: &str) -> std::path::PathBuf {+ let root = std::env::temp_dir().join(format!("ra-{name}-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&root);+ std::fs::create_dir_all(root.join("app/Services")).unwrap();+ std::fs::create_dir_all(root.join("public")).unwrap();+ std::fs::write(+ root.join("composer.json"),+ format!(+ r#"{{"name":"acme/shop","require":{{"php":"^8.2","{framework}":"*"}},"autoload":{{"psr-4":{{"App\\":"app/"}}}}}}"#+ ),+ )+ .unwrap();+ std::fs::write(+ root.join("public/index.php"),+ "<?php\nrequire __DIR__.'/../vendor/autoload.php';\n",+ )+ .unwrap();+ std::fs::write(+ root.join("app/Services/Slugger.php"),+ "<?php\nnamespace App\\Services;\n\nuse Illuminate\\Support\\Str;\n\nclass Slugger\n{\n public static function slug(string $title): string\n {\n return Str::slug($title);\n }\n}\n",+ )+ .unwrap();+ root+}++#[test]+fn laravel_apps_are_planned_toward_laravel_rust() {+ let root = php_app("laravel", "laravel/framework");+ let report = analyze(&root).unwrap();+ let app = rust_anything::whole_app::whole_app(&root, &report);+ std::fs::remove_dir_all(&root).unwrap();+ let services = report+ .units+ .iter()+ .find(|u| u.id == "app/Services/")+ .unwrap_or_else(|| panic!("{:#?}", report.units));+ assert!(+ services+ .external_deps+ .iter()+ .any(|d| d == "laravel/framework"),+ "{services:?}"+ );+ assert_ne!(services.status, Status::Blocked, "{services:?}");+ assert_eq!(app.shape, "server");+ let laravel = app+ .dependencies+ .iter()+ .find(|d| d.name == "laravel/framework")+ .unwrap_or_else(|| panic!("{:#?}", app.dependencies));+ assert_eq!(+ (laravel.crates, laravel.fit),+ (Some("laravel-rust"), "partial")+ );+ let framework = app+ .decisions+ .iter()+ .find(|d| d.topic == "framework")+ .unwrap_or_else(|| panic!("{:#?}", app.decisions));+ assert!(+ framework.recommendation.starts_with("Laravel Rust"),+ "{framework:?}"+ );+ assert!(+ framework.recommendation.contains("app record --http"),+ "{framework:?}"+ );+}++#[test]+fn other_php_frameworks_get_no_laravel_rust_decision() {+ let root = php_app("slim", "slim/slim");+ let report = analyze(&root).unwrap();+ let app = rust_anything::whole_app::whole_app(&root, &report);+ std::fs::remove_dir_all(&root).unwrap();+ assert!(+ app.decisions.iter().all(|d| d.topic != "framework"),+ "{:#?}",+ app.decisions+ );+}+#[test]fn csharp_units_resolve_namespaces_and_map_nuget_packages() {let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/csharp");