Supercharge Your PHP Projects with Flight's Native AI Integration in 2026
Source: Dev.to
Flight PHP and Native AI Integration
Flight PHP keeps things delightfully simple while packing powerful tools for modern workflows. The dedicated AI & Developer Experience section in the official docs shows how Flight makes AI coding assistants shine—especially with built‑in CLI commands via Runway that connect to LLMs and generate project‑specific instructions for tools like GitHub Copilot, Cursor, Windsurf, and Antigravity (Gemini). This native support means your AI helper gets tailored context about your app’s stack, conventions, and goals, leading to more accurate, relevant suggestions every time.
A standout advantage: Flight’s entire core codebase is tiny—easily fitting inside most AI context windows (around 51 k tokens including tests, far below limits like Claude’s 200 k+ or Gemini’s massive capacities). Your AI can ingest the whole framework without truncation, leading to fewer hallucinations and better understanding of Flight’s patterns compared to heavier frameworks.
For new users, this lowers the entry barrier dramatically. For long‑time Flight devs, it streamlines team consistency and speeds up iteration without reinventing wheels.
Start Fast: Use the Official Skeleton with Runway Built‑In
The easiest way to get AI integration running is the official flightphp/skeleton. It comes pre‑configured with Runway (Flight’s CLI tool), predefined AI instruction files, and a solid project structure.
Installation
- Ensure PHP 7.4+ is installed.
- In your terminal, run:
composer create-project flightphp/skeleton my-flight-app
cd my-flight-app
This pulls in Flight core, Runway, and sets up folders like app/, public/, config/, plus AI‑ready files in .github/, .cursor/, etc.
Serve Locally
composer start
Or use PHP’s built‑in server:
php -S localhost:8000 -t public/
Visit .
The skeleton is AI‑friendly out of the box—predefined instructions help your IDE’s AI understand the namespace structure, config loading, and more right away.
Set Up AI Credentials with ai:init
Runway powers the AI commands. First, connect your LLM provider:
php runway ai:init
The command prompts you to:
- Choose a provider (e.g., OpenAI, Grok, Claude).
- Enter a base URL (defaults to OpenAI’s).
- Provide your API key.
- Select a model (e.g.,
gpt-4o,claude-3-opus).
Credentials are saved securely to your project’s config.php. Gemini support comes via Antigravity integration, generating instructions for .gemini/GEMINI.md so Gemini‑powered tools can use the same context.
Generate Smart Instructions with ai:generate-instructions
Run the generator:
php runway ai:generate-instructions
Answer a few prompts about your project (description, database, templating, security focus). Flight then crafts detailed, project‑specific instructions and writes them to:
.github/copilot-instructions.md→ GitHub Copilot.cursor/rules/project-overview.mdc→ Cursor.windsurfrules→ Windsurf.gemini/GEMINI.md→ Antigravity (Gemini)
These files feed context directly to your IDE’s AI, turning vague suggestions into code that respects your routes, PDO usage, JSON responses, and security middleware.
You can rerun the command anytime you add features or change the stack, keeping the instructions fresh and reducing “re‑explain the project” loops.
Why This Matters: Backwards Compatibility and Longevity
Flight has been around since 2011, with a core goal of rock‑solid backwards compatibility. The docs note that v3 retains most v2 patterns with minimal breaking changes (mostly output‑buffering tweaks for MVC alignment). This stability means AI tools trained on older Flight examples still work great today—no version‑specific chaos like in faster‑moving frameworks. The tiny core ensures full context even for mid‑range models.
Practical win: Prompt “Add a grouped admin route with auth middleware in Flight” and the AI references your instructions and Flight’s enduring style to produce clean, compatible code.
Quick Example: AI‑Assisted Route in the Skeleton
With instructions generated, open public/index.php (or a controller) and ask your IDE AI assistant:
“Create a GET
/todosroute using PDO SQLite that returns a JSON array of tasks.”
The AI should output code that respects your DB choice, JSON formatting, and error handling—often ready to commit with little tweaking.
Runway also provides handy shortcuts:
php runway routes # Lists all endpoints
php runway generate:controller Todos # Scaffolds a controller if needed
Flight’s AI features (added in v3.16.0) make rapid, reliable development a joy. Grab the skeleton, initialize your credentials, generate instructions, and watch your AI become a true co‑pilot.
What LLM setup are you running with Flight?