sharpapi / laravel-custom-workflow
Laravel wrapper for SharpAPI Custom AI Workflow SDK - build and execute no-code AI API endpoints
Package info
github.com/sharpapi/laravel-custom-workflow
pkg:composer/sharpapi/laravel-custom-workflow
Requires
- php: >=8.1
- laravel/framework: ^10.48.29|^11.0|^12.0|^13.0
- sharpapi/php-custom-workflow: ^1.0.0
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/testbench: ^8.0|^9.0|^10.0|^11.0
- pestphp/pest: ^2.0|^3.0|^4.0
- pestphp/pest-plugin-laravel: ^2.0|^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
SharpAPI Laravel Custom Workflow
๐ฏ Laravel wrapper for SharpAPI Custom AI Workflows โ build and execute no-code AI API endpoints.
Check the full documentation on the Custom AI Workflows page.
Quick Links
| Resource | Link |
|---|---|
| Product Details | SharpAPI.com |
| PHP SDK (non-Laravel) | sharpapi/php-custom-workflow |
| SDK Libraries | GitHub - SharpAPI SDKs |
Requirements
- PHP >= 8.1
- Laravel 10, 11, 12, or 13
- A SharpAPI account with an API key
Installation
Step 1. Install the package via Composer:
composer require sharpapi/laravel-custom-workflow
Step 2. Visit SharpAPI to get your API key.
Step 3. Add your API key to .env:
SHARP_API_KEY=your-api-key
Step 4 (Optional). Publish the configuration:
php artisan vendor:publish --tag=sharpapi-custom-workflow
What it does
This package provides a Laravel-native wrapper around sharpapi/php-custom-workflow. It adds:
- Service Provider with deferred loading (singleton only created when first used)
- Facade for quick static access
- Dependency Injection support
- Publishable configuration with auto-discovery
Usage (Facade)
use SharpAPI\LaravelCustomWorkflow\Facades\CustomWorkflow; // Execute a workflow $statusUrl = CustomWorkflow::executeWorkflow('my-sentiment-analyzer', [ 'text' => 'Great product!', 'score' => 4.5, ]); // Fetch results when ready $result = CustomWorkflow::fetchResults($statusUrl); // List your workflows $workflows = CustomWorkflow::listWorkflows(); // Describe a workflow's schema $definition = CustomWorkflow::describeWorkflow('my-analyzer'); // Validate + execute in one call $statusUrl = CustomWorkflow::validateAndExecute('my-analyzer', ['text' => 'hello']);
Usage (Dependency Injection)
use SharpAPI\CustomWorkflow\CustomWorkflowClient; class AnalyzeController extends Controller { public function analyze(CustomWorkflowClient $client) { $statusUrl = $client->executeWorkflow('my-sentiment-analyzer', [ 'text' => 'Great product!', ]); return $client->fetchResults($statusUrl); } }
Configuration
After publishing, the config file is at config/sharpapi-custom-workflow.php:
return [ 'api_key' => env('SHARP_API_KEY', env('SHARPAPI_API_KEY')), 'base_url' => env('SHARP_API_BASE_URL', env('SHARPAPI_BASE_URL', 'https://sharpapi.com/api/v1')), ];
| Env variable | Purpose |
|---|---|
SHARP_API_KEY |
Your API key. SHARPAPI_API_KEY is read as a fallback. |
SHARP_API_BASE_URL |
Optional API base URL override, the same name every other SharpAPI package uses. SHARPAPI_BASE_URL is read as a fallback for older installs. |
A missing API key throws SharpAPI\LaravelCustomWorkflow\Exceptions\ApiKeyIsMissing the first time the client is resolved, not at boot.
AI agents (Laravel Boost)
This package ships Laravel Boost resources: a short guideline that is always loaded, and an on-demand sharpapi-custom-workflow skill covering the facade, file uploads, queued polling, error handling and testing. Boost 2 or newer is required.
composer require laravel/boost --dev php artisan boost:install # first time php artisan boost:update --discover # already using Boost
Select sharpapi/laravel-custom-workflow when Boost asks which packages to include.
Do you think our API is missing some obvious functionality?
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
- A2Z WEB LTD
- Dawid Makowski
- Boost your PHP AI capabilities!
License
The MIT License (MIT). Please see License File for more information.
Social Media
๐ For the latest news, tutorials, and case studies, don't forget to follow us on: