Download the PHP package blockshiftnetwork/sapb1-client without Composer
On this page you can find all versions of the php package blockshiftnetwork/sapb1-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blockshiftnetwork/sapb1-client
More information about blockshiftnetwork/sapb1-client
Files in blockshiftnetwork/sapb1-client
Package sapb1-client
Short Description A robust, production-grade Laravel package for SAP Business One HTTP integration, supporting both OData and custom (non-OData) SAP Service Layer (SML) endpoints.
License MIT
Homepage https://github.com/blockshiftnetwork/sapb1-client-laravel
Informations about the package sapb1-client
SAP B1 Client for Laravel
A robust, production-grade Laravel package for SAP Business One HTTP integration, supporting multiple connections, fluent OData queries, and both standard and custom Service Layer endpoints.
Requirements
- PHP 8.3 or higher
- Laravel 11.x, 12.x, or 13.x
Installation
You can install the package via composer:
Publish the config file:
Configuration
The package supports multiple named connections, each with its own server, credentials, and isolated session management. Add your credentials to .env:
The published config file (config/sapb1-client.php):
You can add as many connections as you need. Each connection maintains its own session independently.
Usage
Multiple Connections
The package works like Laravel's DB::connection(). The SapB1 facade resolves to a connection manager that lazily creates client instances per named connection.
Fluent Query Builder
The query() method returns a fluent builder for full CRUD operations on any SAP entity.
Listing records
Finding a single record
Creating a record
Updating a record
When updating documents with collection properties like DocumentLines, use replaceCollections: true to send the B1S-ReplaceCollectionsOnPatch header. Without it, SAP merges lines instead of replacing them.
Deleting a record
Query builder on named connections
All query builder methods work on any connection:
OData Queries with Array Syntax
You can also pass raw OData parameters as an array:
Or build them with the standalone ODataQuery class:
Supported Operators
The where and orWhere methods support these operators:
| Operator | Description | Example |
|---|---|---|
=, eq |
Equal | ->where('CardType', '=', 'cCustomer') |
!=, ne |
Not Equal | ->where('Status', '!=', 'Inactive') |
>, gt |
Greater Than | ->where('Balance', '>', 1000) |
>=, ge |
Greater Than or Equal | ->where('Stock', '>=', 10) |
<, lt |
Less Than | ->where('DocTotal', '<', 500) |
<=, le |
Less Than or Equal | ->where('Discount', '<=', 15) |
contains |
String Contains | ->where('CardName', 'contains', 'Shop') |
startswith |
String Starts With | ->where('ItemCode', 'startswith', 'A') |
endswith |
String Ends With | ->where('Address', 'endswith', 'USA') |
in |
In Array | ->where('GroupCode', 'in', [1, 2, 5]) |
notin |
Not In Array | ->where('Country', 'notin', ['US', 'CA']) |
between |
Between two values | ->where('DocDate', 'between', ['2024-01-01', '2024-01-31']) |
For very specific or complex filters not covered above, pass a Filter instance directly: ->where(new Raw("substring(CardName, 1, 3) eq 'ABC'"))
Custom Headers and SML Requests
File Uploads and Custom Requests
For scenarios like file uploads or other complex requests, use sendRequestWithCallback for direct access to the configured HTTP client:
Direct HTTP Methods
All standard HTTP methods are available on any connection:
Concurrent Requests with Pool
Execute multiple requests concurrently for better performance:
You can also use POST, PUT, PATCH, DELETE in the pool:
Http Macro
You can also create a one-off client with explicit config using the Http::SapB1() macro:
Explicit Logout
Laravel Octane Compatibility
The package is fully compatible with Laravel Octane. The SapB1Manager is registered as a singleton and automatically resets request-specific state (headers, retry flags) at the start of each Octane request. Session cookies are managed via Laravel's cache and are not affected by the reset.
Testing
Credits
- Blockshift Network
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of sapb1-client with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0||^13.0