Install Flight via Composer
masterTo add Flight to your PHP project, use Composer to require the flightphp/core package.
composer require flightphp/corerepository·master·Indexed 25 days ago
https://github.com/flightphp/coreA fast, simple, and extensible micro-framework for PHP designed for building RESTful web applications. Flight features zero dependencies and requires PHP 7.4 or greater. It includes tools for route mapping, controller scaffolding via `make:controller`, route listing, and AI-driven coding instruction generation through commands like `ai:init` and `ai:generate-instructions`.
To add Flight to your PHP project, use Composer to require the flightphp/core package.
composer require flightphp/coreAfter installation, you can define routes and start the framework. If installed via Composer, require the vendor/autoload.php file. Use Flight::route() to map a URL pattern to a callback function, and Flight::start() to begin processing requests.
// if installed with composer
require 'vendor/autoload.php';
// or if installed manually by zip file
// require 'flight/Flight.php';
Flight::route('/', function () {
echo 'hello world!';
});
Flight::start();Using a .runway-config.json file is deprecated. To ensure compatibility and follow current best practices, move your configuration values to app/config/config.php using the migration command.
php runway config:migrateWhen running ai:init, you will be prompted to select one of the following supported LLM API providers:
openai (Default base URL: https://api.openai.com)grok (Default base URL: https://api.x.ai)claude (Default base URL: https://api.anthropic.com)After selecting a provider, you must provide a valid Base URL, an API key, and a Model name. The resulting configuration is stored in your application's ai configuration block.
To use the ai:generate-instructions command, you must provide AI configuration. While a --config-file option exists for legacy .runway-config.json files, it is deprecated.
Recommended Method:
Add your AI configuration to the runway key within your config.php file. The configuration requires an OpenAI-compatible structure with the following keys:
api_key: Your LLM API key.model: The name of the model to use.base_url: The base URL for the LLM API (e.g., an OpenAI-compatible endpoint).Example structure for config.php:
'runway' => [
'ai' => [
'api_key' => 'your_api_key',
'model' => 'gpt-4',
'base_url' => 'https://api.openai.com/v1',
]
]PHP 7.4 or greater. It is compatible with PHP versions greater than 8.The ai:init command supports the following option:
--creds-file: Path to .runway-creds.json file. Note: This option is deprecated. You should use config.php instead.The --config-file option allows you to specify a path to a .runway-config.json file for configuration.
Note: This option is deprecated. It is recommended to move your configuration values to the runway key in your config.php file instead.
When using the routes command, you can use the following flags to limit the output to specific request methods:
--get: Only return GET requests--post: Only return POST requests--delete: Only return DELETE requests--put: Only return PUT requests--patch: Only return PATCH requestsIf no method flag is provided, the command returns all routes.
--get
--post
--delete
--put
--patchUse the make:controller command to scaffold a new controller class. The command automatically appends the Controller suffix if it is not provided and places the file in the controllers/ directory relative to your configured app_root.
<controller>: The name of the controller to create (with or without the Controller suffix).app_root defined in your application configuration (either in app/config/config.php or a .runway-config.json file).The ai:generate-instructions command generates or updates project-specific AI coding instructions by prompting you for project details (such as database type, templating engine, and security requirements) and sending them to an LLM.
It automatically updates several AI context files in your project root:
.github/copilot-instructions.md.cursor/rules/project-overview.mdc.gemini/GEMINI.md.windsurfrulesAGENTS.mdPrerequisites:
ai:init command first to configure your AI credentials.config.php under the runway key.