Open
Conversation
added 9 commits
January 23, 2026 09:30
Prepare repository for PHP SDK development: - Remove C++ source files (src/, include/, tests/, examples/) - Remove C++ build files (CMakeLists.txt, Makefile, cmake/) - Remove C++ build script and .clang-format - Update .gitignore for PHP development - Replace gopher-mcp submodule with gopher-orch - Pin gopher-orch to commit 6b45ffbb (MCP server connection fix) The gopher-orch submodule includes gopher-mcp as a nested submodule with 'update = none' in .gitmodules to prevent automatic updates.
Build script that handles the complete build process: - Updates git submodules with SSH URL rewriting support - Handles 'update = none' in gopher-orch/.gitmodules - Builds gopher-orch native library with CMake - Copies dependency libraries (gopher-mcp, fmt) - Fixes macOS dylib install names for PHP FFI - Checks PHP environment and FFI extension - Runs PHPUnit tests if available
PHP SDK for gopher-orch with native FFI bindings: Core classes: - GopherOrch: FFI loader and native library bindings - GopherAgent: Main agent class for running AI queries - Config/ConfigBuilder: Configuration management - AgentResult/AgentResultStatus: Query result handling Features: - PHP 7.4+ compatibility - PHP FFI extension for native library binding - Builder pattern for configuration - Automatic resource cleanup via destructor - PSR-4 autoloading Requirements: - PHP >= 7.4 - ext-ffi (PHP FFI extension)
Example code demonstrating PHP SDK usage: client_example_json.php: - Creates GopherAgent with JSON server configuration - Queries the agent and displays the response - Shows proper error handling and resource cleanup client_example_json_run.sh: - Convenience script to run the example - Starts local MCP servers (server3001, server3002) - Automatically cleans up on exit Mock MCP servers (TypeScript): - server3001: Weather service (get-weather, get-forecast, get-alerts) - server3002: Utility tools (get-time, generate-password) - Both servers use HTTP/SSE transport on localhost
PHPUnit tests for verifying FFI bindings and SDK functionality: GopherOrchTest.php: - Tests native library availability and initialization - Tests FFI function calls (agent creation, error handling) - Tests library shutdown and re-initialization GopherAgentIntegrationTest.php: - Tests full agent creation through FFI - Tests dispose/cleanup functionality ConfigBuilderTest.php: - Tests builder pattern fluent interface - Tests API key and server config modes - Tests empty/default configuration All tests gracefully skip if native library is not built, allowing unit tests to pass in CI environments without the native library.
- Make PHP check optional (warning instead of error if PHP not installed) - Handle multiple libfmt versions (10, 11, 12) in dylib fixes - Native library build succeeds even without PHP installed
Comprehensive documentation including: - Features and architecture overview - Quick start guide with code examples - Building from source instructions - Native library details and search order - API documentation for GopherAgent and ConfigBuilder - Error handling patterns with exception types - Examples with local MCP servers - Development workflow and project structure - Troubleshooting guide for common issues - Contributing guidelines
The npm run dev command spawns child processes that weren't being terminated when the parent PID was killed. This fix ensures proper cleanup by using process groups and port-based killing as fallback. Changes: - Kill by process group (negative PID) to terminate child processes - Add port-based killing via lsof as fallback for remaining processes - Add INT and TERM signals to the cleanup trap
Set up PHP code formatting with PHP-CS-Fixer: - Add friendsofphp/php-cs-fixer as dev dependency - Create .php-cs-fixer.php configuration (PSR-12 based) - Add composer scripts: cs-fix, cs-check - Update .gitignore with .php-cs-fixer.cache - Add Code Formatting section to README - Apply formatting fixes to all PHP files Changes: - composer.json: Add php-cs-fixer dependency and scripts - .php-cs-fixer.php: Configuration file - .gitignore: Add cache file - README.md: Add Code Formatting section - src/*.php: Apply PSR-12 formatting - tests/*.php: Apply formatting, remove unused imports - examples/*.php: Apply formatting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.