如何在 Laravel 12 或 13 搭配 Scramble 設定 Inertia Typegen
Set up Inertia Typegen in a Laravel 12 or 13 app that runs Scramble
重點導讀
Laravel 和 Inertia 專案裡,頁面收到的資料改了,對應的型別也得跟著更新。
- 這篇教學示範如何在已安裝 Scramble 的 Laravel 12 或 13 專案加入 Inertia Typegen:它會讀取 Scramble 的 OpenAPI 檔案,依照每個 Inertia::render() 呼叫產生頁面型別。
- PHP 程式有變動時,開發伺服器會重新產生檔案,CI 也能檢查已提交的檔案是否過期。教學提醒,Scramble 必須是 0.13.49 或更新版本,較舊版本有安全問題和遞迴錯誤。
- 這個套件仍是 0.x 版,更新前要固定版本並檢視變更紀錄。
AI 伴隨問答
針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:
信源出處dev.to
Set up Inertia Typegen in a Laravel 12 or 13 app that runs Scramble
本文為 888news 精選之重點導讀。若需閱讀作者完整原文、技術細節與官方討論,請前往原始網站。
來源: Dev.to Top Tech (dev.to)
開啟原文