Download the PHP package core45/laravel-kiriengine without Composer
On this page you can find all versions of the php package core45/laravel-kiriengine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download core45/laravel-kiriengine
More information about core45/laravel-kiriengine
Files in core45/laravel-kiriengine
Package laravel-kiriengine
Short Description Laravel KIRI Engine API integration
License MIT
Informations about the package laravel-kiriengine
Laravel KiriEngine Package
A Laravel package for integrating with the KIRI Engine API for 3D scanning and modeling. Now with memory-efficient streaming uploads using cURL and multi-tenant support!
Installation
Configuration
Publish the configuration file:
Add your KIRI Engine API key to your .env file:
Quick Start
Fluent API Key Setting
The easiest way to use KIRI Engine with a specific API key:
Standard Usage
Multi-Tenant Support
The package now supports multi-tenant applications where each user has their own KIRI Engine API key. You can easily configure the package to retrieve API keys from the authenticated user or any other source.
Basic Multi-Tenant Setup
-
Add the API key column to your users table:
-
Update your User model:
- Configure the API key resolver in your config:
Advanced Multi-Tenant Configuration
You can create more complex resolvers for different scenarios:
Fallback Behavior
- If the resolver returns
nullor an empty string, the package will fall back to theKIRIENGINE_API_KEYenvironment variable - If neither source provides a valid API key, an exception will be thrown with a clear error message
Security Considerations
- API keys are automatically hidden from model serialization when added to the
$hiddenarray - Consider encrypting API keys in the database for additional security
- Use proper authentication middleware to ensure only authorized users can access the API
Using in Jobs and Commands
When using KIRI Engine in jobs, commands, or other contexts where authentication isn't available, you can explicitly set the API key.
Fluent API Key Setting (Recommended)
Using the Trait
-
Add the trait to your job or command:
- Alternative ways to set the API key:
Manual API Key Setting
You can also set the API key manually without using the trait:
Command Example
API Key Resolution Priority
The package resolves API keys in this order:
- Explicitly set API key (highest priority - for jobs, commands, etc.)
- Custom resolver function (from config)
- Environment variable (fallback)
Usage
Photo Scanning
Object Scanning
3DGS Scanning
Model Status and Download
Balance Check
File Upload Methods
The package supports multiple ways to provide files, with file paths being the most memory-efficient:
1. File Paths (Recommended - Memory Efficient)
2. File Path Arrays
3. Content Arrays (Not Recommended for Large Files)
Memory Optimization
Important: To avoid memory exhaustion when uploading many large files:
- Use file paths instead of loading content into memory
- Process files in batches if you have hundreds of files
- Avoid
file_get_contents()for large files
Example: Processing Many Files
Example: Working with Spatie Laravel Medialibrary
API Parameters
Different upload methods support different parameters based on the KIRI API endpoints:
Photo Scanning Parameters:
modelQuality(0-3): High, Medium, Low, UltratextureQuality(0-3): 4K, 2K, 1K, 8KisMask(0-1): Auto Object Masking Off/OntextureSmoothing(0-1): Texture Smoothing Off/OnfileFormat: Output format (obj, fbx, stl, ply, glb, gltf, usdz, xyz)
Featureless Object Scanning Parameters:
fileFormat: Output format (obj, fbx, stl, ply, glb, gltf, usdz, xyz)
3DGS Scanning Parameters:
isMesh(0-1): Turn off/on 3DGS to Mesh conversionisMask(0-1): Auto Object Masking Off/OnfileFormat(string): Output format when isMesh=1 (obj, fbx, stl, ply, glb, gltf, usdz, xyz)
Note: Each scanning algorithm has different capabilities:
- Photo Scan: Full quality control with all parameters
- Featureless Object Scan: Only supports file format selection
- 3DGS Scan: Supports mesh conversion and masking, file format only when isMesh=1
Webhooks
The package includes webhook support for receiving model processing updates. When a model is completed, KIRI Engine will send a webhook to your application.
Setup Webhook Routes
The webhook route is automatically registered at /kiri-engine-webhook (configurable via KIRIENGINE_WEBHOOK_PATH).
Webhook Event Handling
The package dispatches a KiriWebhookReceived event when a webhook is received. You can listen to this event to process completed models:
Custom Webhook Processing
The included ProcessKiriWebhook listener automatically:
- Downloads completed models
- Extracts ZIP files
- Saves files to storage
- Handles errors and retries
You can create your own listener to customize the processing:
Error Handling
The package throws KiriengineException for API errors:
Requirements
- Laravel 9+
- PHP 8.1+
- cURL extension (usually included with PHP)
- At least 20 images per upload (maximum 300)
Technical Details
This package uses cURL with CURLFile for memory-efficient file uploads:
- Files are streamed directly from disk without loading into memory
- Uses
CURLFileclass for proper multipart form data handling - 15-minute timeout for large uploads
- Automatic MIME type detection
- Support for temporary files for content arrays
Available Methods
Kiriengine API is divided into six main parts:
- Photo Scan Upload
- Featureless Object Scan Upload
- 3DGS Scan Upload
- Model Status and Get Download Link
- Balance
- Webhook
To access any of the methods use Kiriengine facade and use one of the main shortcut methods followed by the API method name:
Kiriengine::uploadPhotoScan()->...Kiriengine::uploadObjectScan()->...Kiriengine::upload3DgsScan()->...Kiriengine::model3d()->...Kiriengine::balance()->...
All of the available methods you can find in Kiriengine API docs:
If you find any errors or would like to help with improving and maintaining the package please leave the comment.
License
This package is open-sourced software licensed under the MIT license.