PHPackages                             robodocxs/laravel-erp-middleware - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. robodocxs/laravel-erp-middleware

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

robodocxs/laravel-erp-middleware
================================

A middleware package to provide ERP functionality to Robodocxs

2.0.1(1y ago)066MITPHPPHP ^8.1

Since Dec 18Pushed 1y agoCompare

[ Source](https://github.com/robodocxs/laravel-erp-middleware)[ Packagist](https://packagist.org/packages/robodocxs/laravel-erp-middleware)[ RSS](/packages/robodocxs-laravel-erp-middleware/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (8)Used By (0)

Laravel ERP Middleware for Robodocxs
====================================

[](#laravel-erp-middleware-for-robodocxs)

This package provides a middleware for ERP integration in Laravel applications, including basic DTOs, custom middleware for one-time basic authentication, custom exception handling, and additional capabilities for SFTP file system operations and CSV handling.

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

[](#installation)

Only if you want to start from a new laravel project:

```
php artisan laravel new robodocxs-middleware-something
```

Install the package via composer:

```
composer require robodocxs/laravel-erp-middleware
```

After installation, you should publish the configuration file:

```
php artisan vendor:publish --provider="Robodocxs\LaravelErpMiddleware\LaravelErpMiddlewareServiceProvider" --tag="config"
```

This will publish the `robodocxs-erp-middleware.php` configuration file to your config directory.

Then, install the api:

```
php artisan api:install
```

Use this example routes file:

```
Route::middleware('auth.basic.once')->group(function () {

    Route::get('/products', [LaravelErpMiddlewareController::class, 'listProducts'])
        ->name('products.index');

    Route::get('/accounts', [LaravelErpMiddlewareController::class, 'listAccounts'])
        ->name('accounts.index');

    Route::get('/accounts/{account_id}/contacts', [LaravelErpMiddlewareController::class, 'listAccountContacts'])
        ->name('accounts.contacts');

    Route::get('/accounts/{account_id}/addresses', [LaravelErpMiddlewareController::class, 'listAccountAddresses'])
        ->name('accounts.addresses');

    Route::get('/accounts/{account_id}/products', [LaravelErpMiddlewareController::class, 'listAccountCustomProducts'])
        ->name('accounts.products');

    Route::post('/products/price-and-availability', [LaravelErpMiddlewareController::class, 'checkPriceAndAvailability'])
        ->name('products.price-availability');

    Route::get('/ping', [LaravelErpMiddlewareController::class, 'ping'])
        ->name('ping');
});
```

To publish the built-in Controller as a starting point, use this command:

```
laravel-erp-middleware:publish-api-controller
```

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

[](#configuration)

If you need SFTP access, add the following disk to `config/filesystems.php` file directly:

```
'fileshare' => [
    'driver' => 'sftp',
    'host' => env('SFTP_HOST'),
    'username' => env('SFTP_USERNAME'),
    'password' => env('SFTP_PASSWORD'),
    'privateKey' => env('SFTP_PRIVATE_KEY'),
    'passphrase' => env('SFTP_PASSPHRASE'),
    'root' => env('SFTP_ROOT'),
    'visibility' => 'private', // `private` = 0600, `public` = 0644
    'directory_visibility' => 'private', // `private` = 0700, `public` = 0755
    // 'hostFingerprint' => env('SFTP_HOST_FINGERPRINT'),
    // 'maxTries' => 4,
    // 'passphrase' => env('SFTP_PASSPHRASE'),
    // 'port' => env('SFTP_PORT', 22),
    // 'root' => env('SFTP_ROOT', ''),
    // 'timeout' => 30,
    // 'useAgent' => true,
    // Setting for the environment
]

```

Then add the following keys to your env to use the disk:

```
SFTP_HOST=your_sftp_host
SFTP_USERNAME=your_username
SFTP_PASSWORD=your_password
SFTP_PRIVATE_KEY=path_to_your_private_key
SFTP_PASSPHRASE=your_passphrase
SFTP_ROOT=/home/someuser

```

Features
--------

[](#features)

- Basic DTOs using spatie/laravel-data
- Custom middleware for one-time basic authentication
- Custom exception handling for API-friendly responses
- SFTP file system operations using league/flysystem-sftp-v3
- CSV handling capabilities using league/csv

API Routes and Middleware Controller
------------------------------------

[](#api-routes-and-middleware-controller)

This package provides pre-defined API routes and a middleware controller to handle them. All routes are protected by the `AuthenticateOnceWithBasicAuth` middleware, which implements one-time basic authentication.

The following routes are available:

### 1. List Products

[](#1-list-products)

- **Endpoint:** `GET /api/products`
- **Query Parameters:** `search` (optional)
- **Response:** Collection of ProductDTOs

### 2. List Accounts

[](#2-list-accounts)

- **Endpoint:** `GET /api/accounts`
- **Query Parameters:** `name`, `vat_id` (both optional)
- **Response:** Collection of AccountDTOs

### 3. List Account Contacts

[](#3-list-account-contacts)

- **Endpoint:** `GET /api/accounts/{account_id}/contacts`
- **Response:** Collection of ContactDTOs

### 4. List Account Addresses

[](#4-list-account-addresses)

- **Endpoint:** `GET /api/accounts/{account_id}/addresses`
- **Response:** Collection of AddressDTOs

### 5. List Account Custom Products

[](#5-list-account-custom-products)

- **Endpoint:** `GET /api/accounts/{account_id}/products`
- **Response:** Collection of CustomOrderCodeDTOs

### 6. List ERP Documents

[](#6-list-erp-documents)

- **Endpoint:** `POST /api/accounts/{account_id}/erp-documents`
- **Response:** Array of ErpDocumentDTO objects

### 7. Check Price and Availability

[](#7-check-price-and-availability)

- **Endpoint:** `POST /api/products/price-and-availability`
- **Request Body:** Array of PARequestDTO objects
- **Response:** Array of PAResponseDTO objects

All these routes require authentication. The `AuthenticateOnceWithBasicAuth` middleware will prompt for credentials on the first request and then allow subsequent requests without re-authentication for a limited time.

Usage
-----

[](#usage)

### DTOs

[](#dtos)

This package requires DTOs from robodocxs/robodocxs-middleware-dtos. They serve as the glue between the backend and the middlewares.

### Custom Middleware

[](#custom-middleware)

This package includes a middleware for one-time basic authentication. It's automatically applied to all API routes provided by this package. If you want to use it in your own routes, you can do so like this:

```
Route::get('/api/example', function () {
    // Your protected route logic here
})->middleware('auth.basic.once');
```

### SFTP Operations

[](#sftp-operations)

This package configures a new 'fileshare' disk for SFTP operations. After publishing and configuring the `sftp.php` config file, you can use it like this:

```
use Illuminate\Support\Facades\Storage;

$disk = Storage::disk('fileshare');

// Now you can use $disk to perform SFTP operations
$contents = $disk->get('file.txt');
$disk->put('file.txt', 'Contents');
```

### CSV Handling

[](#csv-handling)

This package includes the league/csv package for CSV operations. Here's a basic example of reading a CSV file:

```
use League\Csv\Reader;

$csv = Reader::createFromPath('/path/to/your/csv/file.csv', 'r');
$csv->setHeaderOffset(0);

foreach ($csv as $record) {
    // Process each record
}
```

For more detailed usage instructions for SFTP and CSV operations, please refer to the respective package documentation:

- [league/flysystem-sftp-v3 documentation](https://flysystem.thephpleague.com/docs/adapter/sftp-v3/)
- [league/csv documentation](https://csv.thephpleague.com/)

Deploying
---------

[](#deploying)

When deploying to dev or prod servers, use these defaults for .env:

```
SESSION_DRIVER=redis

QUEUE_CONNECTION=redis

CACHE_STORE=redis
CACHE_PREFIX="${APP_NAME}"

REDIS_DB=
```

Testing
-------

[](#testing)

To run the package tests, use:

```
composer test
```

Development
-----------

[](#development)

To symlink this project in your local middleware for faster development, follow these steps:

1. Add repository to `composer.json`

```
"repositories": [
    {
        "type": "path",
        "url": "../laravel-erp-middleware",
        "options": {
            "symlink": true
        }
    }
]

```

2. Require `dev-main` and prefer source:

```
composer require robodocxs/laravel-erp-middleware:dev-main --prefer-source

```

If you want to also symlink robodocxs/robodocxs-middleware-dtos in your project, you have to do it directly in that project. It is not possible to symlink it here and expect your project to pick it up from here.

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

[](#contributing)

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

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance49

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~23 days

Recently: every ~17 days

Total

7

Last Release

372d ago

Major Versions

1.5.0 → 2.0.02025-03-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/634671acab4174704372245a3fdcd53c95ace1d1f38419ab3069f9b69d4faf55?d=identicon)[robodocxs](/maintainers/robodocxs)

---

Top Contributors

[![isarphilipp](https://avatars.githubusercontent.com/u/9417412?v=4)](https://github.com/isarphilipp "isarphilipp (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/robodocxs-laravel-erp-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/robodocxs-laravel-erp-middleware/health.svg)](https://phpackages.com/packages/robodocxs-laravel-erp-middleware)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[firefly-iii/data-importer

Firefly III Data Import Tool.

7545.8k](/packages/firefly-iii-data-importer)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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