PHP Doublets Adapter via GraphQL client #39
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.
🎯 Summary
This pull request implements a complete PHP Doublets Adapter that provides standard Doublets CRUD operations API in native PHP code style via GraphQL client. The library connects to the LinksPlatform Doublets GraphQL server and provides an idiomatic PHP interface for working with Links (Doublets).
✨ Features Implemented
gmostafa/php-graphql-clientlibrary underneath🏗️ Architecture
The library follows clean architecture principles with separated concerns:
📦 Installation & Usage
Installation via Composer
Quick Start
🧪 Testing
The implementation includes comprehensive unit tests:
LinkTest- Tests Link model functionalityLinksCollectionTest- Tests collection operations and utilitiesLinksQueryTest- Tests query builder functionalityDoubletsClientFactoryTest- Tests factory methodsRun tests with:
composer test📚 Examples
The library includes practical examples:
basic_usage.php- Demonstrates core CRUD operationsbatch_operations.php- Shows batch operations and advanced queryingconfiguration.php- Covers all configuration options🔧 Configuration Options
Multiple ways to configure the client:
🔄 Future Compatibility
The library is designed with a swappable architecture. When the native C++ library becomes available, the GraphQL client layer can be replaced without changing the public API. The
LinksInterfacecontract ensures compatibility.📋 Files Added
Core Library
src/LinksInterface.php- Main contract interfacesrc/DoubletsClient.php- Primary implementationsrc/DoubletsClientFactory.php- Factory for easy instantiationsrc/Link.php- Link modelsrc/LinksCollection.php- Collection with utilitiessrc/LinksQuery.php- Fluent query builderGraphQL Layer
src/GraphQL/GraphQLClient.php- GraphQL client wrappersrc/GraphQL/QueryBuilder.php- Converts PHP queries to GraphQLException Handling
src/Exception/LinksException.php- Links-specific exceptionssrc/Exception/GraphQLException.php- GraphQL-specific exceptionsConfiguration
composer.json- Composer package configurationphpunit.xml- PHPUnit test configurationphpcs.xml- PHP CodeSniffer configurationTests
tests/LinkTest.php- Link model teststests/LinksCollectionTest.php- Collection teststests/LinksQueryTest.php- Query builder teststests/DoubletsClientFactoryTest.php- Factory testsDocumentation & Examples
README.md- Comprehensive documentationexamples/basic_usage.php- Basic operations demoexamples/batch_operations.php- Advanced operations demoexamples/configuration.php- Configuration examples🎯 Fixes
Closes #16
📝 Notes
gmostafa/php-graphql-clientas GraphQL client foundationThe implementation provides exactly what was requested in the issue: a PHP Doublets adapter that works via GraphQL client, provides native PHP API style, and can be swapped with a native library later.
🤖 Generated with Claude Code