PHPackages                             core45/laravel-baselinker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. core45/laravel-baselinker

ActiveLibrary[API Development](/categories/api)

core45/laravel-baselinker
=========================

Laravel Baselinker API integration

2.0.0(5mo ago)2118MITPHPPHP &gt;=8.1

Since Dec 24Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/core45/laravel-baselinker)[ Packagist](https://packagist.org/packages/core45/laravel-baselinker)[ RSS](/packages/core45-laravel-baselinker/feed)WikiDiscussions main Synced yesterday

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

Baselinker API integration for Laravel
======================================

[](#baselinker-api-integration-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0b65a947f073c6453f5b7ac722c35bbe9ff76bbbdbee79e585c60111d6622fc7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f726534352f6c61726176656c2d626173656c696e6b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/core45/laravel-baselinker)[![Total Downloads](https://camo.githubusercontent.com/707039c6a2fa4fe595058ecc1398789786ea44a186e3c391e1026931cc855a87/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f726534352f6c61726176656c2d626173656c696e6b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/core45/laravel-baselinker)

A comprehensive Laravel package for integrating with the [Baselinker/Base.com](https://baselinker.com) API. This package provides a clean, fluent interface for the Catalog, External Storage, Order, and Shipment modules.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Laravel &gt;= 9.0

Installation
------------

[](#installation)

Install the package with composer:

```
composer require core45/laravel-baselinker
```

Optionally publish the configuration file:

```
php artisan vendor:publish --provider="Core45\LaravelBaselinker\BaselinkerServiceProvider"
```

The package is auto-discovered by Laravel. After installation, add your API token to your `.env` file:

```
BASELINKER_TOKEN=your-api-token-here
BASELINKER_DEBUG=false
```

Usage
-----

[](#usage)

The Baselinker API is divided into 4 main modules:

ModuleDescription**Catalog**Product catalog, inventories, price groups, warehouses, categories, manufacturers, tags**External Storage**External shops and wholesalers connected to Baselinker**Order**Orders, receipts, invoices, order sources, order returns**Shipment**Courier shipments, labels, protocols, pickup requestsAccess any module using the `Baselinker` facade:

```
use Core45\LaravelBaselinker\Facades\Baselinker;

// Access modules
$catalog = Baselinker::catalog();
$externalStorage = Baselinker::externalStorage();
$order = Baselinker::order();
$shipment = Baselinker::shipment();
```

Catalog Module
--------------

[](#catalog-module)

### Inventories

[](#inventories)

```
// Get list of inventories
$inventories = Baselinker::catalog()->getInventories();

// Add a new inventory
$result = Baselinker::catalog()->addInventory(
    name: 'Main Warehouse',
    description: 'Primary product warehouse',
    languages: ['en', 'pl'],
    defaultLanguage: 'en',
    priceGroups: [1, 2],
    defaultPriceGroup: 1,
    warehouses: ['bl_123'],
    defaultWarehouse: 'bl_123',
    reservations: true
);
```

### Price Groups

[](#price-groups)

```
// Get price groups
$priceGroups = Baselinker::catalog()->getInventoryPriceGroups();

// Add a price group
$result = Baselinker::catalog()->addInventoryPriceGroup(
    name: 'Retail Prices',
    description: 'Standard retail pricing',
    currency: 'EUR'
);
```

### Warehouses

[](#warehouses)

```
// Get warehouses
$warehouses = Baselinker::catalog()->getInventoryWarehouses();

// Add a warehouse
$result = Baselinker::catalog()->addInventoryWarehouse(
    name: 'Main Warehouse',
    description: 'Primary storage location',
    stockEdition: true
);
```

### Categories

[](#categories)

```
// Get categories
$categories = Baselinker::catalog()->getInventoryCategories(inventoryId: 123);

// Add a category
$result = Baselinker::catalog()->addInventoryCategory(
    inventoryId: 123,
    name: 'Electronics',
    parentId: 0 // 0 for root category
);
```

### Products

[](#products)

```
// Get products list
$products = Baselinker::catalog()->getInventoryProductsList(
    inventoryId: 123,
    filterCategoryId: 456,
    filterSort: 'name ASC',
    page: 1
);

// Get product data
$product = Baselinker::catalog()->getInventoryProductsData(
    inventoryId: 123,
    products: [1001, 1002, 1003]
);

// Add a product
$result = Baselinker::catalog()->addInventoryProduct(
    inventoryId: 123,
    productId: 'new', // 'new' for new product or existing ID
    parentId: null,
    isBundle: false,
    ean: '1234567890123',
    sku: 'PROD-001',
    taxRate: 23.0,
    weight: 0.5,
    height: 10.0,
    width: 20.0,
    length: 30.0,
    star: 0,
    manufacturerId: 1,
    categoryId: 456,
    prices: ['1' => 99.99, '2' => 89.99],
    stock: ['bl_123' => 100],
    locations: ['bl_123' => 'A1-B2'],
    textFields: [
        'name|en' => 'Product Name',
        'description|en' => 'Product description',
        'features|en' => 'Feature 1|Feature 2'
    ],
    images: ['https://example.com/image1.jpg'],
    links: ['https://example.com/product'],
    bundleProducts: []
);

// Update stock
$result = Baselinker::catalog()->updateInventoryProductsStock(
    inventoryId: 123,
    products: [
        ['product_id' => 1001, 'variant_id' => 0, 'stock' => ['bl_123' => 50]]
    ]
);
```

### Manufacturers &amp; Tags

[](#manufacturers--tags)

```
// Get manufacturers
$manufacturers = Baselinker::catalog()->getInventoryManufacturers();

// Add a manufacturer
$result = Baselinker::catalog()->addInventoryManufacturer(
    name: 'Apple Inc.'
);

// Get tags
$tags = Baselinker::catalog()->getInventoryTags();
```

External Storage Module
-----------------------

[](#external-storage-module)

```
// Get list of connected external storages
$storages = Baselinker::externalStorage()->getExternalStoragesList();

// Get categories from external storage
$categories = Baselinker::externalStorage()->getExternalStorageCategories(
    storageId: 'shop_2445'
);

// Get products list
$products = Baselinker::externalStorage()->getExternalStorageProductsList(
    storageId: 'shop_2445',
    filterSort: 'name ASC',
    page: 1
);

// Get product details
$productData = Baselinker::externalStorage()->getExternalStorageProductsData(
    storageId: 'shop_2445',
    products: [18755, 18756]
);

// Update stock in external storage
$result = Baselinker::externalStorage()->updateExternalStorageProductsQuantity(
    storageId: 'shop_2445',
    products: [
        [1081730, 0, 100],      // [product_id, variant_id (0=main), quantity]
        [1081730, 1734642, 50]  // Update variant stock
    ]
);
```

Order Module
------------

[](#order-module)

### Managing Orders

[](#managing-orders)

```
// Get journal (order changes log)
$journal = Baselinker::order()->getJournalList(
    lastLogId: 0,
    logsTypes: [1, 2], // 1 = new order, 2 = order update
    orderId: null
);

// Get orders
$orders = Baselinker::order()->getOrders(
    orderId: null,
    dateConfirmedFrom: 1609459200, // Unix timestamp
    dateFrom: null,
    idFrom: null,
    getUnconfirmedOrders: false,
    includeCustomExtraFields: true,
    statusId: null,
    filterEmail: null,
    filterOrderSource: null,
    filterOrderSourceId: null
);

// Add a new order
$result = Baselinker::order()->addOrder(
    orderStatusId: 1234,
    dateAdd: time(),
    currency: 'EUR',
    paymentMethod: 'PayPal',
    paymentMethodCod: 0,
    paid: 1,
    userComments: 'Please deliver before 5 PM',
    adminComments: 'VIP customer',
    email: 'customer@example.com',
    phone: '+48123456789',
    userLogin: 'johndoe',
    deliveryMethod: 'DPD',
    deliveryPrice: 9.99,
    deliveryFullname: 'John Doe',
    deliveryCompany: 'ACME Inc.',
    deliveryAddress: '123 Main Street',
    deliveryPostcode: '00-001',
    deliveryCity: 'Warsaw',
    deliveryState: '',
    deliveryCountryCode: 'PL',
    deliveryPointId: '',
    deliveryPointName: '',
    deliveryPointAddress: '',
    deliveryPointPostcode: '',
    deliveryPointCity: '',
    invoiceFullname: 'John Doe',
    invoiceCompany: 'ACME Inc.',
    invoiceNip: 'PL1234567890',
    invoiceAddress: '123 Main Street',
    invoicePostcode: '00-001',
    invoiceCity: 'Warsaw',
    invoiceState: '',
    invoiceCountryCode: 'PL',
    wantInvoice: 1,
    extraField1: '',
    extraField2: '',
    customExtraFields: [],
    products: [
        [
            'storage' => 'bl',
            'storage_id' => 123,
            'product_id' => 1001,
            'variant_id' => 0,
            'name' => 'Product Name',
            'sku' => 'SKU-001',
            'ean' => '1234567890123',
            'price_brutto' => 99.99,
            'tax_rate' => 23,
            'quantity' => 2,
            'weight' => 0.5
        ]
    ]
);

// Update order fields
$result = Baselinker::order()->setOrderFields(
    orderId: 6910995,
    adminComments: 'Updated comment',
    deliveryAddress: 'New Address 456'
);

// Set order status
$result = Baselinker::order()->setOrderStatus(
    orderId: 6910995,
    statusId: 5678
);

// Delete orders
$result = Baselinker::order()->deleteOrders(
    orderIds: [6910995, 6910996]
);
```

### Order Products

[](#order-products)

```
// Add product to order
$result = Baselinker::order()->addOrderProduct(
    orderId: 6910995,
    storage: 'bl',
    storageId: 123,
    productId: 1001,
    name: 'New Product',
    priceBrutto: 49.99,
    taxRate: 23,
    quantity: 1
);

// Set product fields
$result = Baselinker::order()->setOrderProductFields(
    orderId: 6910995,
    orderProductId: 12345,
    priceBrutto: 39.99
);

// Delete product from order
$result = Baselinker::order()->deleteOrderProduct(
    orderId: 6910995,
    orderProductId: 12345
);
```

### Order Statuses &amp; Sources

[](#order-statuses--sources)

```
// Get order status list
$statuses = Baselinker::order()->getOrderStatusList();

// Get order sources
$sources = Baselinker::order()->getOrderSources();
```

### Receipts &amp; Invoices

[](#receipts--invoices)

```
// Get receipts
$receipts = Baselinker::order()->getReceipts(
    receiptId: null,
    orderId: 6910995,
    dateFrom: null,
    seriesId: null
);

// Get invoices
$invoices = Baselinker::order()->getInvoices(
    invoiceId: null,
    orderId: 6910995,
    dateFrom: null,
    seriesId: null,
    getExternalInvoices: false
);

// Get invoice file
$file = Baselinker::order()->getInvoiceFile(invoiceId: 123456);

// Add invoice
$result = Baselinker::order()->addInvoice(
    orderId: 6910995,
    seriesId: 1
);
```

### Order Returns (New in v2.0)

[](#order-returns-new-in-v20)

```
// Get return reasons
$reasons = Baselinker::order()->getOrderReturnReasonsList();

// Get order return journal
$journal = Baselinker::order()->getOrderReturnJournalList(
    lastLogId: 0,
    logsTypes: [1, 2]
);

// Get returns
$returns = Baselinker::order()->getOrderReturns(
    orderReturnId: null,
    orderId: null,
    dateFrom: 1609459200,
    idFrom: null,
    statusId: null,
    includeCustomExtraFields: true
);

// Add a return
try {
    $result = Baselinker::order()->addOrderReturn(
        orderId: 6910995,
        statusId: 100, // This is the ID of the return status
        adminComments: 'Return created by support',
        products: [
            ['order_product_id' => 12345, 'quantity' => 1]
        ],
        dateAdd: time(),
        currency: 'EUR',
        refunded: false
    );
} catch (\Core45\LaravelBaselinker\Exceptions\BaselinkerException $e) {
    // Handle API error
    // e.g., Log::error($e->getMessage());
}

// Set return status
$result = Baselinker::order()->setOrderReturnStatus(
    returnId: 789,
    statusId: 200
);
```

Shipment Module
---------------

[](#shipment-module)

### Couriers

[](#couriers)

```
// Get list of available couriers
$couriers = Baselinker::shipment()->getCouriersList();

// Get courier accounts
$accounts = Baselinker::shipment()->getCourierAccounts(courierCode: 'dpd');

// Get courier form fields
$fields = Baselinker::shipment()->getCourierFields(courierCode: 'dpd');
```

### Creating Shipments

[](#creating-shipments)

```
// Create a shipment
$result = Baselinker::shipment()->createPackage(
    orderId: 6910995,
    courierCode: 'dpd',
    fields: [
        ['id' => 'cod', 'value' => '0'],
        ['id' => 'insurance', 'value' => '1']
    ],
    packages: [
        ['weight' => '2', 'height' => '30', 'width' => '20', 'length' => '40']
    ],
    accountId: null
);

// Manually add shipment (for packages created outside Baselinker)
$result = Baselinker::shipment()->createPackageManual(
    orderId: 6910995,
    courierCode: 'dpd',
    packageNumber: '1234567890',
    pickupDate: '1622505600'
);

// Get packages for order
$packages = Baselinker::shipment()->getOrderPackages(orderId: 6910995);

// Delete a package
$result = Baselinker::shipment()->deleteCourierPackage(
    courierCode: 'dpd',
    packageId: 123456
);
```

### Labels &amp; Protocols

[](#labels--protocols)

```
// Get shipping label
$label = Baselinker::shipment()->getLabel(
    courierCode: 'dpd',
    packageId: 123456
);

// Get protocol
$protocol = Baselinker::shipment()->getProtocol(
    courierCode: 'dpd',
    packageIds: [123456, 123457]
);
```

### Pickup Requests

[](#pickup-requests)

```
// Get pickup request fields
$fields = Baselinker::shipment()->getRequestParcelPickupFields(courierCode: 'dpd');

// Request parcel pickup
$result = Baselinker::shipment()->runRequestParcelPickup(
    courierCode: 'dpd',
    packageIds: [123456, 123457],
    fields: [
        ['id' => 'pickup_date', 'value' => '1642416311'],
        ['id' => 'shipments_weight', 'value' => '40']
    ]
);
```

### Package Status History

[](#package-status-history)

```
// Get status history for packages
$history = Baselinker::shipment()->getCourierPackagesStatusHistory(
    packageIds: [123456, 123457]
);
```

Configuration
-------------

[](#configuration)

The configuration file (`config/baselinker.php`) contains:

```
return [
    'token' => env('BASELINKER_TOKEN'),
    'debug' => env('BASELINKER_DEBUG', false),
    'verify' => env('BASELINKER_VERIFY', true), // SSL verification
];
```

API Rate Limiting
-----------------

[](#api-rate-limiting)

Baselinker API has a rate limit of **100 requests per minute**. The package does not implement automatic rate limiting, so you should handle this in your application if making many requests.

Error Handling
--------------

[](#error-handling)

The package now uses centralized exception handling. If the Baselinker API returns an error, or if there is an HTTP-level failure, the package will throw a `\Core45\LaravelBaselinker\Exceptions\BaselinkerException`.

You should wrap your API calls in a `try...catch` block to handle potential errors gracefully.

```
use Core45\LaravelBaselinker\Facades\Baselinker;
use Core45\LaravelBaselinker\Exceptions\BaselinkerException;
use Illuminate\Support\Facades\Log;

try {
    $inventories = Baselinker::catalog()->getInventories();
    // Handle success
} catch (BaselinkerException $e) {
    // Handle API error
    Log::error('Baselinker API Error: ' . $e->getMessage());
    // You can also get the error code if needed
    $errorCode = $e->getCode();
} catch (\Illuminate\Http\Client\RequestException $e) {
    // Handle HTTP connection error
    Log::error('Baselinker Connection Error: ' . $e->getMessage());
}
```

Official API Documentation
--------------------------

[](#official-api-documentation)

For complete API documentation, visit:

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for more information.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance71

Regular maintenance activity

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~189 days

Total

5

Last Release

166d ago

Major Versions

v1.x-dev → 2.0.02026-01-18

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17904235?v=4)[Kornel](/maintainers/core45)[@core45](https://github.com/core45)

---

Top Contributors

[![core45](https://avatars.githubusercontent.com/u/17904235?v=4)](https://github.com/core45 "core45 (15 commits)")[![mirouse](https://avatars.githubusercontent.com/u/2631240?v=4)](https://github.com/mirouse "mirouse (5 commits)")

### Embed Badge

![Health badge](/badges/core45-laravel-baselinker/health.svg)

```
[![Health](https://phpackages.com/badges/core45-laravel-baselinker/health.svg)](https://phpackages.com/packages/core45-laravel-baselinker)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M986](/packages/statamic-cms)[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

3.0k37.6M134](/packages/darkaonline-l5-swagger)[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k14.2M63](/packages/knuckleswtf-scribe)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

783.8k](/packages/scriptdevelop-whatsapp-manager)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.7k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
