thoaud / ongoing-warehouse-php
PHP client library for the Ongoing Warehouse Management System REST API
Requires
- php: >=7.4
- guzzlehttp/guzzle: ^7.0
- guzzlehttp/psr7: ^2.0
- psr/http-client: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2025-07-22 01:41:09 UTC
README
A PHP client library for the Ongoing Warehouse Management System REST API. This library provides a convenient way to interact with the Ongoing WMS API from PHP applications.
Features
- Complete API Coverage: All Ongoing WMS REST API endpoints are supported
- Type Safety: Full PHP type hints and return type declarations
- PSR Standards: Compliant with PSR-7, PSR-18, and PSR-4
- Modern PHP: Requires PHP 7.4+ with modern features
- Composer Ready: Easy installation via Composer
- Well Documented: Comprehensive PHPDoc comments
Installation
Via Composer
composer require thoaud/ongoing-warehouse-php
Manual Installation
- Download the latest release
- Extract to your project directory
- Include the autoloader:
require_once 'path/to/ongoing-api-php/autoload.php';
Quick Start
Basic Configuration
<?php require_once 'vendor/autoload.php'; use OngoingAPI\Configuration; use OngoingAPI\Api\ArticlesApi; // Configure the API client $config = new Configuration(); $config->setHost('https://api.ongoingsystems.se/your-warehouse'); $config->setUsername('your-username'); $config->setPassword('your-password'); // Create an API instance $articlesApi = new ArticlesApi(null, $config);
Example: Get All Articles
<?php use OngoingAPI\Api\ArticlesApi; use OngoingAPI\Configuration; // Setup configuration $config = new Configuration(); $config->setHost('https://api.ongoingsystems.se/your-warehouse'); $config->setUsername('your-username'); $config->setPassword('your-password'); // Create API client $articlesApi = new ArticlesApi(null, $config); try { // Get all articles for a goods owner $articles = $articlesApi->articlesGetAll(123); // goods_owner_id = 123 foreach ($articles as $article) { echo "Article: " . $article->getArticleName() . "\n"; echo "Stock: " . $article->getInventoryInfo()->getSellableNumberOfItems() . "\n"; } } catch (Exception $e) { echo "Error: " . $e->getMessage() . "\n"; }
Example: Create an Order
<?php use OngoingAPI\Api\OrdersApi; use OngoingAPI\Configuration; use OngoingAPI\Model\GetOrderModel; use OngoingAPI\Model\GetOrderLine; // Setup configuration $config = new Configuration(); $config->setHost('https://api.ongoingsystems.se/your-warehouse'); $config->setUsername('your-username'); $config->setPassword('your-password'); // Create API client $ordersApi = new OrdersApi(null, $config); try { // Create order model $order = new GetOrderModel(); $order->setOrderNumber('ORD-001'); $order->setGoodsOwnerId(123); // Add order line $orderLine = new GetOrderLine(); $orderLine->setRowNumber(1); $orderLine->setArticleNumber('ART-001'); $orderLine->setNumberOfItems(5); $order->setOrderLines([$orderLine]); // Create the order $result = $ordersApi->ordersPut($order); echo "Order created successfully!\n"; } catch (Exception $e) { echo "Error: " . $e->getMessage() . "\n"; }
API Endpoints
This library provides access to all Ongoing WMS API endpoints:
Articles
ArticlesApi
- Manage articles, inventory, and article dataArticleItemsApi
- Work with individual article items
Orders
OrdersApi
- Create and manage customer ordersReturnOrdersApi
- Handle return orders
Purchase Orders
PurchaseOrdersApi
- Manage incoming purchase orders
Inventory
InventoryAdjustmentsApi
- Handle inventory adjustments
Warehouses
WarehousesApi
- Warehouse information and management
Invoices
InvoicesApi
- Invoice management
Transport
TransporterContractsApi
- Transporter contract managementParcelTypesApi
- Parcel type information
Configuration Options
Authentication
The API uses HTTP Basic Authentication:
$config->setUsername('your-username'); $config->setPassword('your-password');
Host Configuration
Set your warehouse-specific API URL:
$config->setHost('https://api.ongoingsystems.se/your-warehouse');
Debug Mode
Enable debug mode for troubleshooting:
$config->setDebug(true); $config->setDebugFile('/path/to/debug.log');
Custom HTTP Client
You can use a custom HTTP client:
use GuzzleHttp\Client; $client = new Client([ 'timeout' => 30, 'verify' => false // Only for development ]); $articlesApi = new ArticlesApi($client, $config);
Error Handling
The library throws exceptions for API errors:
try { $articles = $articlesApi->articlesGetAll(123); } catch (\OngoingAPI\ApiException $e) { echo "API Error: " . $e->getMessage() . "\n"; echo "Response Code: " . $e->getCode() . "\n"; echo "Response Body: " . $e->getResponseBody() . "\n"; } catch (\Exception $e) { echo "General Error: " . $e->getMessage() . "\n"; }
Pagination
Many API endpoints support pagination. Use the max_articles_to_get
parameter:
// Get first 100 articles $articles = $articlesApi->articlesGetAll(123, null, null, 100); // Get next 100 articles (using article_system_id_from) $nextArticles = $articlesApi->articlesGetAll(123, null, $lastArticleId, 100);
Development
Running Tests
composer test
Code Quality
# Run PHPStan static analysis composer phpstan # Run PHP CodeSniffer composer phpcs # Auto-fix coding standards composer phpcbf
Building Documentation
# Generate API documentation
composer docs
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Support
- Documentation: Ongoing WMS API Documentation
- Email: phpdevsec@proton.me
- Issues: GitHub Issues
License
This library is licensed under the MIT License. See the LICENSE file for details.
Changelog
See CHANGELOG.md for a list of changes and version history.
Acknowledgments
- Ongoing Warehouse for providing the API
- OpenAPI Generator for generating the base client code
- Directhouse for development and maintenance