GitHub Copilot SDK for Laravel is a community SDK that brings the official GitHub Copilot SDK workflow into Laravel applications.
You can call Copilot from Artisan commands, controllers, jobs, and other Laravel runtime contexts.
What is specific to Laravel
This package adds Laravel-native ergonomics on top of an SDK-compatible layer:
- Facade-first API with
Copilot::run() and Copilot::start()
- Laravel-style configuration via
config/copilot.php and .env
- Integration points for Laravel Prompts, queues, and console UX
- Testing utilities such as
Copilot::fake() and prompt assertions
Usage examples
Run single prompt
use Revolution\Copilot\Facades\Copilot;
$response = Copilot::run(prompt: 'Tell me something about Laravel.');
dump($response->content());
Multiple prompts in a single session
use Revolution\Copilot\Contracts\CopilotSession;
use Revolution\Copilot\Facades\Copilot;
$content = Copilot::start(function (CopilotSession $session) {
dump('Starting Copilot session: '.$session->id());
$response = $session->sendAndWait(prompt: 'Tell me something about PHP.');
dump($response->content());
$response = $session->sendAndWait(prompt: 'Tell me something about Laravel.');
dump($response->content());
return $response->content();
});
dump($content);
copilot() helper
use Revolution\Copilot\Contracts\CopilotSession;
use function Revolution\Copilot\copilot;
// If you specify a prompt as a string, it is the same as Copilot::run().
$response = copilot('Tell me something about Laravel.');
// If you pass a closure, it is the same as Copilot::start().
copilot(function (CopilotSession $session) {
$response = $session->sendAndWait(prompt: 'Tell me something about PHP.');
});
// If you don't pass anything, it's the same as Facade.
dump(copilot()->client()->ping());
Start here
Getting started
Build your first Copilot-powered Laravel app.
Authentication
Configure GitHub login, token-based auth, or BYOK workflows.
Session config
Control tools, models, MCP servers, and session behavior.
SessionEvent
Understand Laravel-specific event helpers and lifecycle handling.
Permission request
Review the permission flow to run tools with explicit approval.
Tools
Define custom tools that Copilot can call.
Streaming
Handle incremental output and live assistant responses.
MCP
Connect MCP servers to extend capabilities.
Laravel Cloud
Run the SDK in Laravel Cloud environments.
Custom providers
Integrate additional provider and model strategies.
Official repositories
Last modified on April 19, 2026