protendai/sap-business-one

Sap Business One for laravel applications

v1.0.0-alpha 2022-05-28 09:37 UTC

This package is auto-updated.

Last update: 2025-06-29 02:00:09 UTC


README

Installation

composer require protendai/sap-business-one

Configuration

Add the following line to your Config/app.php Providers:

    Protendai\SapBusinessOne\SapBusinessOneServiceProvider::class

Add the following line to your Config/app.php Aliases:

    'SAPClient' => Protendai\SapBusinessOne\SAPClient::class,

You can publish the config using this command:

    php artisan vendor:publish --provider="Protendai\SapBusinessOne\SapBusinessOneServiceProvider"

The defaults configuration settings are set in config/sap.php as shown below and you can modify the values.

'sap' => [
        "https"         => false,
        "host"          => "IP/HOST Address eg 192.168.1.1",
        "port"          => 50000,
        "sslOptions"    => ["cafile" => "path/to/certificate.crt","verify_peer" => true,"verify_peer_name" => true,],
        "version"       => 1
    ],

You update config using this command:

    php artisan config:cache

Using

Use SAPClient in your controller.

    use Protendai\SapBusinessOne\SAPClient;

Create a new Service Layer session.

    $sap = SAPClient::createSession('SAP UserName', 'SAP Password', 'Company DB');

Grab the SAP Business One session.

    $session = $sap->getSession();

Example of pulling orders using session saved above:

    $sap = new SAPClient(config('sap.sap') ,$session);
    $orders = $sap->getService('Orders');
    $result = $orders->queryBuilder()
    ->select('DocEntry,DocNum')
    ->orderBy('DocNum', 'asc')
    ->limit(5)
    ->findAll();

License

This SapBusinessOne Wrapper for Laravel is open-sourced software licensed under the MIT license