Download the PHP package robodocxs/laravel-erp-middleware without Composer
On this page you can find all versions of the php package robodocxs/laravel-erp-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download robodocxs/laravel-erp-middleware
More information about robodocxs/laravel-erp-middleware
Files in robodocxs/laravel-erp-middleware
Package laravel-erp-middleware
Short Description A middleware package to provide ERP functionality to Robodocxs
License MIT
Informations about the package laravel-erp-middleware
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
Only if you want to start from a new laravel project:
Install the package via composer:
After installation, you should publish the configuration file:
This will publish the robodocxs-erp-middleware.php
configuration file to your config directory.
Then, install the api:
Use this example routes file:
To publish the built-in Controller as a starting point, use this command:
Configuration
If you need SFTP access, add the following disk to config/filesystems.php
file directly:
Then add the following keys to your env to use the disk:
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
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
- Endpoint:
GET /api/products
- Query Parameters:
search
(optional) - Response: Collection of ProductDTOs
2. List Accounts
- Endpoint:
GET /api/accounts
- Query Parameters:
name
,vat_id
(both optional) - Response: Collection of AccountDTOs
3. List Account Contacts
- Endpoint:
GET /api/accounts/{account_id}/contacts
- Response: Collection of ContactDTOs
4. List Account Addresses
- Endpoint:
GET /api/accounts/{account_id}/addresses
- Response: Collection of AddressDTOs
5. List Account Custom Products
- Endpoint:
GET /api/accounts/{account_id}/products
- Response: Collection of CustomOrderCodeDTOs
6. List ERP Documents
- Endpoint:
POST /api/accounts/{account_id}/erp-documents
- Response: Array of ErpDocumentDTO objects
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
DTOs
This package requires DTOs from robodocxs/robodocxs-middleware-dtos. They serve as the glue between the backend and the middlewares.
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:
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:
CSV Handling
This package includes the league/csv package for CSV operations. Here's a basic example of reading a CSV file:
For more detailed usage instructions for SFTP and CSV operations, please refer to the respective package documentation:
Deploying
When deploying to dev or prod servers, use these defaults for .env:
Testing
To run the package tests, use:
Development
To symlink this project in your local middleware for faster development, follow these steps:
-
Add repository to
composer.json
- Require
dev-main
and 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
Contributions are welcome! Please feel free to submit a Pull Request.
License
The MIT License (MIT).
All versions of laravel-erp-middleware with dependencies
laravel/framework Version ^10.0|^11.0|^12.0
league/csv Version ^9.0
league/flysystem-sftp-v3 Version ^3.28
robodocxs/robodocxs-middleware-dtos Version ^1.0
spatie/laravel-data Version ^3.0