Skip to content

Conversation

@tlaverdure
Copy link
Contributor

This pull request introduces several improvements and refactorings to the Litebase PHP client, focusing on stricter type safety, configuration handling, and code clarity. The most significant changes are the addition of strict typing declarations across all source files, a major refactor of the configuration and client instantiation process, and improvements to request handling and documentation.

Type Safety and Code Consistency

Configuration and Client Initialization Refactor

  • Refactored the Configuration class to add a static create() method for instantiating from an array, added transport property and getter/setter, and improved PHPDoc comments. [1] [2] [3]
  • Simplified LitebasePDO to accept a LitebaseClient instance directly, removing manual configuration handling and redundant setter methods. [1] [2]
  • Updated LitebaseClient to set transport type in the constructor and added/improved several methods with better documentation and null safety. [1] [2] [3] [4] [5] [6]

Request Handling Improvements

  • Fixed port handling in HasRequestHeaders to treat port values as strings and use string formatting, improving header correctness.
  • Updated Connection to use transactionId (camelCase) instead of transactionID (PascalCase) for response parsing, ensuring compatibility with API responses.

Testing and Autoloading

  • Changed the autoload-dev namespace in composer.json to use Tests\ instead of Litebase\Tests\, aligning with standard conventions.

These changes collectively improve the maintainability, reliability, and clarity of the Litebase PHP client library.

Updated test namespaces from 'Litebase\Tests' to 'Tests' for consistency and PSR-4 compliance. Refactored LitebasePDO to accept a LitebaseClient instance directly, simplifying its construction and configuration. Added a static Configuration::create method for easier configuration instantiation. Updated all affected tests and usages accordingly.
Added declare(strict_types=1); to all source and test PHP files to enforce strict type checking. Also made minor code style improvements, such as consistent spacing around concatenation operators and lambda formatting.
Introduces a configurable transport type to Configuration and LitebaseClient, including new getter/setter methods. Updates request header logic for port handling, fixes transactionId key in Connection, and enhances integration tests to cover both default and http_streaming transports, including access key creation for streaming transport.
@tlaverdure tlaverdure self-assigned this Nov 18, 2025
@tlaverdure tlaverdure added the enhancement New feature or request label Nov 18, 2025
@tlaverdure tlaverdure merged commit f3fbda7 into main Nov 18, 2025
3 checks passed
@tlaverdure tlaverdure deleted the update-pdo-configuration branch November 18, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants