Download the PHP package schababerle-digital/odata-client without Composer
On this page you can find all versions of the php package schababerle-digital/odata-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download schababerle-digital/odata-client
More information about schababerle-digital/odata-client
Files in schababerle-digital/odata-client
Package odata-client
Short Description A PHP client library for OData services.
License MIT
Informations about the package odata-client
OData Client for PHP
⚠️ Important note: This is an early alpha release! ⚠️
This software is in an early development phase (alpha). The API may change without notice and there may be bugs or incomplete features. Use in production environments is currently not recommended.
A modern, easy-to-use PHP client library for interacting with OData services (version 2 and version 4 are supported). This library was developed with best practices in mind, including clear responsibilities, use of interfaces and PSR compatibility.
Features
- Support for OData version 2 and version 4.
- Fluid query builder for creating complex queries (
$select
,$filter
,$expand
,$orderby
,$top
,$skip
,$count
,$search
). - Advanced
FilterBuilder
for programmatic creation of$filter
expressions. - Automatic parsing of OData responses into
Entity
andEntityCollection
objects. - Serialization of entities for create (POST) and update operations (PUT/PATCH/MERGE).
- Support for CRUD operations (Create, Read, Update, Delete).
- Calling OData functions and actions.
- Batch requests for OData V4 (JSON format).
- Flexible HTTP client layer through
HttpClientInterface
(standard implementation with Guzzle). - Structured exception handling.
Requirements
- PHP >= 8.0
- Composer
- A PSR-18 compatible HTTP client implementation (e.g.
guzzlehttp/guzzle
) - PSR-7 HTTP Message Interfaces (
psr/http-message
)
Installation
You can install the library via Composer:
Quick start / basic usage
Here is a simple example of how you can use the OData V4 client:
Using the OData V2 client
The use of the V2 client is analogous, simply replace the V4-specific classes with their V2 equivalents:
Create an entity (example for V4)
Configuration
HTTP client options
You can configure the underlying HTTP client (e.g. Guzzle) with various options when it is instantiated, such as timeouts, authentication, proxy settings, etc. These are then used by the GuzzleHttpClient. These are then used by the GuzzleHttpClient.
Execute tests
To run the PHPUnit tests for this library:
- Clone the repository (if not already done).
-
Install the dependencies with Composer:
- Run PHPUnit from the main directory of the project:
Code Coverage
If you have installed and configured a code coverage driver such as Xdebug or PCOV, you can generate an HTML coverage report:
Then open build/coverage/html/index.html
in your browser.
Contributing
Contributions are welcome! Please create a fork of the repository, create a feature branch, commit your changes and create a pull request. Make sure that all tests are still successful.
License
This library is released under the MIT license. See the LICENSE file for more information.
Notes for you:
- Package name: In the composer.json you have used schababerledigital/odata-client. This name should also be used consistently here in the README, especially in the installation section.
- Authors: Update the authors section in composer.json and here if necessary.
- Examples: Expand the examples to show more features of your client (e.g. update, delete, functions/actions, batch requests in more detail).
- Specific configurations: If your client has special configuration options that go beyond the HTTP client options, document them.
- Badges: Once your project is on Packagist and you have set up CI/CD (like GitHub Actions, Travis CI) and code coverage services (like Coveralls, Codecov), you can replace the placeholders for the badges with real ones.
All versions of odata-client with dependencies
guzzlehttp/guzzle Version ^7.9
psr/http-client Version ^1.0
psr/http-message Version ^1.0 || ^2.0