Auto-generated PHP client for the Composio API - Build AI applications faster with production-ready toolkits and integrations.
β οΈ Important Notice: This is a generated client library based on Composio's OpenAPI specification. It is not maintained by Composio directly. For official SDKs, please check Composio's official repositories.
Composio is an open source platform that provides production-ready toolkits for building AI applications faster. With over 150+ integrations with popular services, Composio simplifies the process of connecting AI applications with external tools.
- π 150+ Integrations: Salesforce, Gmail, Slack, GitHub, and many more
- π Multiple Authentication Methods: OAuth, API Keys, custom flows
- β‘ Production-Ready: Designed for scalable applications
- π Comprehensive Documentation: Detailed guides and API references
- π οΈ Open Source: Open source with community contributions
- PHP 8.1 or higher
- Composer for dependency management
- PHP Extensions:
json,curl,mbstring
To use this generated client, you can install it from your local repository or create a package. Here's how to add it from a local path:
composer require blockshiftnetwork/composio-phpThis client was generated using:
- OpenAPI Generator: v7.17.0
- API Version: v3.0.0
- Source: Composio's OpenAPI specification
- Language: PHP Client
- Build Date: 2025-12-05
To regenerate this client:
openapi-generator-cli generate -i openapi.json -g php -o composio2 --additional-properties invokerPackage=BlockshiftNetwork\\ComposioComposio supports multiple authentication methods:
<?php
require_once 'vendor/autoload.php';
use BlockshiftNetwork\Composio\Configuration;
// Configure API key
$config = Configuration::getDefaultConfiguration()
->setApiKey('x-api-key', 'YOUR_API_KEY')
->setHost('https://backend.composio.dev');$config = Configuration::getDefaultConfiguration()
->setApiKey('authToken', 'YOUR_SESSION_TOKEN')
->setApiKeyPrefix('authToken', '');$config = Configuration::getDefaultConfiguration()
->setApiKey('x-org-api-key', 'YOUR_ORG_API_KEY');<?php
require_once 'vendor/autoload.php';
use BlockshiftNetwork\Composio\Configuration;
use BlockshiftNetwork\Composio\Api\ToolkitsApi;
use GuzzleHttp\Client;
// Configure authentication
$config = Configuration::getDefaultConfiguration()
->setApiKey('x-api-key', 'YOUR_API_KEY');
// Create API instance
$api = new ToolkitsApi(
new Client(),
$config
);
try {
// List all available toolkits
$result = $api->getToolkits();
echo "Available toolkits:\n";
foreach ($result->getItems() as $toolkit) {
echo "- {$toolkit->getName()} ({$toolkit->getSlug()})\n";
echo " Description: {$toolkit->getMeta()->getDescription()}\n";
echo " Categories: " . implode(', ', $toolkit->getMeta()->getCategories()) . "\n\n";
}
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}<?php
use BlockshiftNetwork\Composio\Api\ToolsApi;
use BlockshiftNetwork\Composio\Model\PostToolsExecuteByToolSlugRequest;
// Create tools API instance
$toolsApi = new ToolsApi(
new Client(),
$config
);
// Execute a specific tool
$request = new PostToolsExecuteByToolSlugRequest([
'arguments' => [
'repository' => 'username/repository',
'title' => 'Issue created from PHP SDK',
'body' => 'This issue was created automatically using Composio PHP SDK'
],
'connected_account_id' => 'CONNECTED_ACCOUNT_ID'
]);
try {
$result = $toolsApi->postToolsExecuteByToolSlug('github_create_issue', $request);
echo "Issue created successfully:\n";
echo "URL: {$result->getData()->html_url}\n";
} catch (Exception $e) {
echo "Error executing tool: " . $e->getMessage() . "\n";
}<?php
use BlockshiftNetwork\Composio\Api\ConnectedAccountsApi;
$connectedAccountsApi = new ConnectedAccountsApi(
new Client(),
$config
);
try {
// List connected accounts
$accounts = $connectedAccountsApi->getConnectedAccounts();
echo "Connected accounts:\n";
foreach ($accounts->getItems() as $account) {
echo "- {$account->getToolkit()->getName()}: ";
echo $account->getStatus() === 'ACTIVE' ? 'β
Active' : 'β Inactive';
echo "\n";
}
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}The SDK provides access to all Composio API endpoints:
GET /api/v3/auth/session/info- Get current session informationPOST /api/v3/auth/session/logout- End user session
GET /api/v3/toolkits- List available toolkitsGET /api/v3/toolkits/{slug}- Get specific toolkitGET /api/v3/toolkits/categories- List categoriesPOST /api/v3/toolkits/multi- Fetch multiple toolkits
GET /api/v3/tools- List available toolsGET /api/v3/tools/{tool_slug}- Get specific toolPOST /api/v3/tools/execute/{tool_slug}- Execute toolPOST /api/v3/tools/execute/{tool_slug}/input- Generate inputs from natural language
GET /api/v3/connected_accounts- List connected accountsPOST /api/v3/connected_accounts- Create new connected accountDELETE /api/v3/connected_accounts/{nanoid}- Delete connected accountPOST /api/v3/connected_accounts/{nanoid}/refresh- Refresh authentication
POST /api/v3/tool_router/session- Create tool router sessionPOST /api/v3/tool_router/session/{session_id}/execute- Execute in session
And many more endpoints for managing:
- Authentication Configurations (
/api/v3/auth_configs) - Projects and Organizations (
/api/v3/org/owner/project) - MCP Servers (
/api/v3/mcp) - Triggers (
/api/v3/triggers) - Files (
/api/v3/files)
The SDK includes PHP models for all Composio entities:
Tool- Tool informationConnectedAccount- Connected accountsAuthConfig- Authentication configurationsToolkit- Toolkit informationError- Error handling- And many more...
Composio organizes its toolkits into categories:
- Gmail - Email management
- Slack - Team communication
- Notion - Knowledge management
- Trello - Project management
- GitHub - Version control
- GitLab - Code repositories
- Jira - Issue tracking
- Figma - Collaborative design
- Salesforce - CRM
- HubSpot - Marketing and sales
- Google Sheets - Spreadsheets
- Airtable - Database
- Shopify - Online store
- Stripe - Payments
- WooCommerce - WordPress e-commerce
Composio supports multiple authentication methods:
- Standard authorization flow
- Automatic refresh tokens
- Custom scopes handling
- Static API keys
- Custom headers
- Query parameters
- Username/Password
- HTTP Basic Auth
- OAuth 1.0
- Bearer Tokens
- Custom headers
- Form-based authentication
To run the included tests:
# Install development dependencies
composer install --dev
# Run tests
vendor/bin/phpunit<?php
use BlockshiftNetwork\Composio\Api\ToolRouterApi;
use BlockshiftNetwork\Composio\Model\PostToolRouterSessionRequest;
$toolRouterApi = new ToolRouterApi(new Client(), $config);
// Create a Tool Router session
$sessionRequest = new PostToolRouterSessionRequest([
'user_id' => 'user_123',
'config' => [
'toolkits' => [
'enabled' => ['github', 'slack', 'gmail']
]
]
]);
$session = $toolRouterApi->postToolRouterSession($sessionRequest);
echo "Session created: {$session->getSessionId()}\n";
// Execute in session
$executeRequest = [
'tool_slug' => 'github_create_issue',
'arguments' => [
'repository' => 'user/repo',
'title' => 'Issue from Tool Router'
]
];
$result = $toolRouterApi->postToolRouterSessionBySessionIdExecute(
$session->getSessionId(),
$executeRequest
);<?php
use BlockshiftNetwork\Composio\ApiException;
try {
$result = $api->someMethod();
} catch (ApiException $e) {
echo "API Error: {$e->getCode()} {$e->getMessage()}\n";
echo "Response body: {$e->getResponseBody()}\n";
echo "Response headers: " . json_encode($e->getResponseHeaders()) . "\n";
} catch (Exception $e) {
echo "General error: " . $e->getMessage() . "\n";
}// App/Http/Controllers/ComposioController.php
namespace App\Http\Controllers;
use BlockshiftNetwork\Composio\Configuration;
use BlockshiftNetwork\Composio\Api\ToolkitsApi;
class ComposioController extends Controller
{
protected $config;
protected $api;
public function __construct()
{
$this->config = Configuration::getDefaultConfiguration()
->setApiKey('x-api-key', config('services.composio.api_key'));
$this->api = new ToolkitsApi(
new \GuzzleHttp\Client(),
$this->config
);
}
public function index()
{
$toolkits = $this->api->getToolkits();
return view('composio.index', ['toolkits' => $toolkits->getItems()]);
}
}// src/Service/ComposioService.php
namespace App\Service;
use BlockshiftNetwork\Composio\Configuration;
use BlockshiftNetwork\Composio\Api\ToolsApi;
class ComposioService
{
private Configuration $config;
private ToolsApi $toolsApi;
public function __construct(string $apiKey)
{
$this->config = Configuration::getDefaultConfiguration()
->setApiKey('x-api-key', $apiKey);
$this->toolsApi = new ToolsApi(
new \GuzzleHttp\Client(),
$this->config
);
}
public function executeTool(string $toolSlug, array $arguments): array
{
$request = new \BlockshiftNetwork\Composio\Model\PostToolsExecuteByToolSlugRequest([
'arguments' => $arguments
]);
$result = $this->toolsApi->postToolsExecuteByToolSlug($toolSlug, $request);
return $result->getData();
}
}// Environment variables
$config = Configuration::getDefaultConfiguration()
->setApiKey('x-api-key', $_ENV['COMPOSIO_API_KEY'])
->setHost($_ENV['COMPOSIO_API_HOST'] ?? 'https://backend.composio.dev');class ComposioClientFactory
{
private static ?Configuration $config = null;
public static function getConfig(): Configuration
{
if (self::$config === null) {
self::$config = Configuration::getDefaultConfiguration()
->setApiKey('x-api-key', $_ENV['COMPOSIO_API_KEY']);
}
return self::$config;
}
public static function createToolkitsApi(): ToolkitsApi
{
return new ToolkitsApi(
new \GuzzleHttp\Client([
'timeout' => 30,
'connect_timeout' => 10
]),
self::getConfig()
);
}
}use Monolog\Logger;
use Monolog\Handler\StreamHandler;
$logger = new Logger('composio');
$logger->pushHandler(new StreamHandler('logs/composio.log', Logger::DEBUG));
// Add middleware to Guzzle for logging
$client = new \GuzzleHttp\Client([
'handler' => \GuzzleHttp\HandlerStack::create(),
]);
$handler = $client->getConfig('handler');
$handler->push(\GuzzleHttp\Middleware::log(
$logger,
new \GuzzleHttp\MessageFormatter('{method} {uri} - {code} - {req_body}')
));- This is an auto-generated client library based on Composio's OpenAPI specification
- Not officially maintained by Composio
- Generated using OpenAPI Generator v7.17.0
- Based on Composio API v3.0.0
- This client reflects the state of the OpenAPI specification at the time of generation
- Features may be outdated if the API has been updated
- For official support, contact Composio directly or use their official SDKs
- β When you need a PHP client for Composio's API
- β When there's no official PHP SDK available
- β For rapid prototyping and development
- β For production-critical applications without thorough testing
Since this is an auto-generated client, contributions should focus on:
- API Specification Updates: Update the OpenAPI spec if Composio releases new versions
- Generation Improvements: Enhance the generation process or configuration
- Documentation: Improve this README and examples
- Bug Reports: Report issues with the generated client
Note: Do not manually edit the generated API files, as they will be overwritten during regeneration. Instead, update the OpenAPI specification and regenerate the client.
This generated client follows the licensing terms of the OpenAPI Generator and the Composio API specification. Check the LICENSE file for specific licensing details.
- Documentation: https://composio.dev/docs
- API Reference: https://composio.dev/docs/api-reference
- Official Support: support@composio.dev
Since this is an auto-generated client, issues should be reported to:
- This Repository: blockshiftnetwork/composio-php
- OpenAPI Generator: For generation-specific issues
- Composio: For API specification problems
Important: This generated client is not officially supported by Composio. For official SDK support, please use Composio's official repositories.
- Composio Website
- Official Documentation
- GitHub Repository
- API Reference
- Authentication Guide
- Available Toolkits
- β Generated from Composio OpenAPI specification v3.0.0
- β Full support for all API v3 endpoints
- β PHP models for all entities
- β Multiple authentication methods
- β Tool Router support
- β Complete documentation and examples
- β Generated using OpenAPI Generator v7.17.0
- Composio Website
- Official Documentation
- API Reference
- Authentication Guide
- Available Toolkits
- Composio GitHub
Build AI applications faster with Composio's production-ready toolkits π