DEV Community

Cover image for Supercharge Your PHP Projects with Flight's Native AI Integration in 2026
n0nag0n
n0nag0n

Posted on

Supercharge Your PHP Projects with Flight's Native AI Integration in 2026

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 51k tokens including tests, far below limits like Claude's 200k+ 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.

Step-by-step for newcomers:

  1. Ensure PHP 7.4+ is installed.
  2. In your terminal, run:
composer create-project flightphp/skeleton my-flight-app
cd my-flight-app
Enter fullscreen mode Exit fullscreen mode

This pulls in Flight core, Runway, and sets up folders like app/, public/, config/, plus AI-ready files in .github/, .cursor/, etc.

  1. Serve it locally:
composer start
Enter fullscreen mode Exit fullscreen mode

Or use PHP's built-in server: php -S localhost:8000 -t public/. You're live at http://localhost:8000.

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
Enter fullscreen mode Exit fullscreen mode

It prompts you:

  • Choose provider: 1 for OpenAI, 2 for Grok, 3 for Claude (supports any OpenAI-compatible API).
  • Base URL (defaults to OpenAI's).
  • Your API key.
  • Model (e.g., gpt-4o, claude-3-opus).

Credentials save securely to your config.php file in your project.

Gemini support comes via Antigravity integration—instructions generate for .gemini/GEMINI.md, letting Gemini-powered tools use the same context.

Generate Smart Instructions with ai:generate-instructions

This is where the magic happens. Run:

php runway ai:generate-instructions
Enter fullscreen mode Exit fullscreen mode

Answer prompts about your project:

  • Description (e.g., "RESTful API for task management").
  • Database (SQLite, MySQL, PostgreSQL?).
  • Templating (Latte, Twig, none?).
  • Security focus (yes/no for auth/validation emphasis).

Flight uses your LLM to craft detailed, project-specific instructions, then 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. Instead of vague suggestions, Copilot or Cursor knows you're using Flight routes, PDO for DB, JSON responses, and security middleware—leading to code that slots in perfectly, follows your conventions, and avoids common pitfalls.

Rerun anytime (new features, stack changes) to keep instructions fresh. This reduces "re-explain the project" loops and boosts productivity across teams.

Why This Matters: Backwards Compatibility and Longevity

Flight's been around since 2011, and one core goal is rock-solid backwards compatibility. The docs repeatedly note it maintains compatibility wherever possible—v3 keeps most v2 patterns intact 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. Your prompts pull from years of consistent patterns, and the tiny core ensures full context in even mid-range models.

Practical win: Prompt "Add a grouped admin route with auth middleware in Flight"—the AI references your instructions and Flight's enduring style for clean, compatible code.

Quick Example: AI-Assisted Route in Skeleton

With instructions generated, open public/index.php (or a controller). Ask your in IDE AI Assistant: "Create a GET /todos route using PDO SQLite that returns JSON array of tasks."

Expect output respecting your project's DB choice, JSON formatting, and error handling—often ready to commit with little tweaking.

Runway bonus: php runway routes lists all endpoints; php runway generate:controller Todos scaffolds if needed.

Flight's AI features (added in v3.16.0) make it a joy for rapid, reliable development. Grab the skeleton, init your creds, generate instructions, and watch your AI become a true co-pilot.

What LLM setup are you running with Flight? Share in the comments.

Stay cool,

n0nag0n

Top comments (0)