Download the PHP package hardimpactdev/opencode-sdk-laravel without Composer

On this page you can find all versions of the php package hardimpactdev/opencode-sdk-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package opencode-sdk-laravel

OpenCode SDK for Laravel

A Laravel SDK for the OpenCode AI coding agent HTTP API, built with Saloon.

Requirements

Installation

The package auto-registers its service provider via Laravel's package discovery.

Configuration

Publish the config file:

Usage

Using the Facade

Using Dependency Injection

Without Laravel

Sessions

Sending Messages

Slash Commands

Session Operations

Permissions (Questions)

When OpenCode needs approval for tool usage (file edits, bash commands, etc.), permissions appear as events. Respond programmatically:

Event Streaming (SSE)

Monitor real-time state changes via Server-Sent Events:

Projects

Providers

Session Management

The SDK includes an Eloquent model (OpenCodeSession) and a SessionManager for tracking and managing session lifecycles in your application.

OpenCodeSession Model

SessionManager

The SessionManager provides session lifecycle management with assessment heuristics and Laravel event dispatching.

All lifecycle methods are idempotent — calling them on a session already in the target state is a no-op.

Tolerant Deserialization

The SDK handles unknown enum values from the API gracefully. Unknown part types, message roles, and tool statuses are mapped to Unknown enum cases instead of throwing exceptions:

Error Handling

DTO-returning methods (e.g. sessions()->get(), sessions()->messages()) throw on HTTP errors. Boolean-returning methods (e.g. sessions()->delete(), sessions()->abort()) return false on failure instead of throwing.

Feature Parity

Comparison with the official OpenCode SDKs (JS, Go).

Session

Endpoint Laravel JS Go
Create session Y Y Y
List sessions Y Y Y
Get session Y Y Y
Update session Y - Y
Delete session Y Y Y
Abort session Y Y Y
Send message (sync) Y Y Y
Send message (async) Y - -
Get messages Y Y Y
Get single message - - Y
Run slash command Y - Y
Run shell command - - Y
Init session Y Y Y
Summarize session Y Y Y
Revert session Y Y Y
Unrevert session Y Y Y
Share session Y Y Y
Unshare session Y Y Y
Get child sessions - - Y

Permissions

Endpoint Laravel JS Go
List pending Y - -
Respond (once/always/reject) Y - Y

Events

Endpoint Laravel JS Go
SSE event stream Y Y Y

Providers

Endpoint Laravel JS Go
List providers + models Y Y Y

App

Endpoint Laravel JS Go
Get app info - Y -
Init app - Y -
Log - Y Y
List modes - Y -

Config

Endpoint Laravel JS Go
Get config - Y Y

File

Endpoint Laravel JS Go
List files - - Y
Read file - Y Y
File status (git) - Y Y

Find

Endpoint Laravel JS Go
Find files - Y Y
Find symbols - Y Y
Find text - Y Y

Agent

Endpoint Laravel JS Go
List agents - - Y

Project

Endpoint Laravel JS Go
List projects Y - Y
Current project Y - Y
Update project Y - -

Session Management (Laravel-only)

Feature Laravel JS Go
OpenCodeSession Eloquent model Y - -
SessionManager (lifecycle + assess) Y - -
Laravel event dispatching Y - -
Tolerant enum deserialization Y - -

Command

Endpoint Laravel JS Go
List commands - - Y

Path

Endpoint Laravel JS Go
Get paths - - Y

TUI

Endpoint Laravel JS Go
Append/clear/submit prompt - Y Y
Open help/models/sessions/themes - Y Y
Execute command - - Y
Show toast - - Y

Testing

Static Analysis

Code Style

License

MIT


All versions of opencode-sdk-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/contracts Version ^11.0||^12.0||^13.0
illuminate/database Version ^11.0||^12.0||^13.0
saloonphp/saloon Version ^4.0
spatie/laravel-data Version ^4.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hardimpactdev/opencode-sdk-laravel contains the following files

Loading the files please wait ...