tigusigalpa / manus-ai-php
π Manus AI PHP SDK - Complete library for integration with Manus AI API. Easy integration of Manus AI agent into PHP applications with Laravel support. Task automation, AI agents, file management. Full documentation, code examples, API support.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/tigusigalpa/manus-ai-php
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.8
- illuminate/support: ^8|^9|^10|^11|^12
Requires (Dev)
- mockery/mockery: ^1.6
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0|^11.0
README
π The Ultimate PHP Library for Manus AI Integration π
Unlock the power of AI automation in your PHP applications with enterprise-grade reliability
π Why Choose Manus AI PHP SDK?
Welcome to the most comprehensive and developer-friendly PHP SDK for Manus AI - the cutting-edge AI agent platform that's revolutionizing workflow automation. Whether you're building intelligent chatbots, automating complex business processes, or creating AI-powered applications, this SDK provides everything you need to harness the full potential of Manus AI's advanced capabilities.
π― Perfect For:
- π’ Enterprise Applications: Build scalable AI-powered solutions with robust error handling and type safety
- π€ Chatbot Development: Create intelligent conversational interfaces with context-aware responses
- π Data Analysis: Automate document processing, report generation, and data extraction workflows
- π Workflow Automation: Streamline repetitive tasks with AI-driven automation
- πΌ SaaS Platforms: Integrate AI capabilities into your software-as-a-service products
- π Educational Tools: Develop AI-assisted learning and tutoring applications
- π± Mobile Backends: Power your mobile apps with intelligent server-side AI processing
π What Makes This SDK Special?
This isn't just another API wrapper - it's a production-ready, battle-tested solution designed by developers, for developers. Built with modern PHP 8.2+ features, comprehensive Laravel integration, and an intuitive API that feels natural to use. Every method is documented, every edge case is handled, and every feature is tested.
π Table of Contents
- Features
- Requirements
- Installation
- Configuration
- Usage
- API Reference
- Examples
- Testing
- Contributing
- License
β¨ Powerful Features That Set You Apart
π¨ Core Capabilities
- β Complete Manus AI API Coverage: Full implementation of all Manus AI endpoints with zero compromises
- β Intelligent Task Management: Create, monitor, update, and control AI agent tasks with granular control
- β Advanced File Handling: Seamless file upload, attachment management, and multi-format support (PDF, images, documents)
- β Real-Time Webhook Integration: Stay synchronized with instant notifications for task lifecycle events
- β Multi-Model Support: Access to Manus 1.6, Lite, and Max variants for optimal performance/cost balance
π Laravel Excellence
- β Native Laravel Integration: First-class service provider, facade, and dependency injection support
- β Powerful Artisan Commands: Manage AI tasks directly from your terminal with intuitive CLI tools
- β Configuration Publishing: Customize every aspect through Laravel's familiar config system
- β
Environment-Based Setup: Secure API key management through
.envfiles
π‘οΈ Enterprise-Grade Quality
- β Comprehensive Error Handling: Graceful failure management with detailed exception messages
- β Type-Safe Architecture: Full PHP 8.2+ type hints for IDE autocomplete and early error detection
- β 100% Test Coverage: Extensive PHPUnit test suite ensuring reliability
- β PSR-4 Autoloading: Modern PHP standards compliance for seamless integration
- β Production-Ready: Battle-tested in real-world applications
π Developer Experience
- β Extensive Documentation: Every method documented with examples and use cases
- β Working Code Examples: Ready-to-run examples for common scenarios
- β Helper Classes: Convenient utilities for attachments, profiles, and webhook handling
- β Intuitive API Design: Methods that feel natural and follow PHP conventions
- β Active Maintenance: Regular updates and community support
π¦ Requirements
- PHP 8.2 or higher
- Composer
- Guzzle HTTP client (^7.8)
- Laravel 8+ (optional, for Laravel integration)
π§ Installation & Quick Start
Step 1: Install via Composer
Getting started is as simple as running a single command. The SDK is available on Packagist and can be installed in seconds:
composer require tigusigalpa/manus-ai-php
This will automatically install all required dependencies, including the Guzzle HTTP client for reliable API communication.
Step 2: Get Your API Key
Before you can start creating AI-powered tasks, you'll need an API key from Manus AI:
- π Visit Manus AI and create a free account
- π Navigate to API Integration Settings
- π Copy your unique API key
Step 3: Quick Start (30 Seconds)
Create your first AI task in just a few lines of code:
<?php require 'vendor/autoload.php'; use Tigusigalpa\ManusAI\ManusAIClient; // Initialize the client $client = new ManusAIClient('your-api-key-here'); // Create your first AI task $result = $client->createTask('Write a creative story about a PHP developer who discovers AI'); // Get the results echo "β Task Created Successfully!\n"; echo "π Task ID: {$result['task_id']}\n"; echo "π View Task: {$result['task_url']}\n";
That's it! You're now ready to build powerful AI-driven applications. π
For Laravel Users
Laravel developers get even more convenience with automatic service provider registration:
# Install the package composer require tigusigalpa/manus-ai-php # Add your API key to .env echo "MANUS_AI_API_KEY=your-api-key-here" >> .env # Test the connection php artisan manus-ai:test
βοΈ Configuration
Getting Your API Key
- Sign up at Manus AI
- Get your API key from the API Integration settings
PHP Configuration
use Tigusigalpa\ManusAI\ManusAIClient; $apiKey = 'your-api-key-here'; $client = new ManusAIClient($apiKey);
Laravel Configuration
1. Publish Configuration (Optional)
php artisan vendor:publish --tag=manus-ai-config
2. Add to .env
MANUS_AI_API_KEY=your-api-key-here MANUS_AI_DEFAULT_AGENT_PROFILE=manus-1.6 MANUS_AI_DEFAULT_TASK_MODE=agent
π Usage
This SDK provides a simple and intuitive interface to interact with Manus AI's powerful automation capabilities. Whether you're creating AI-powered tasks, managing file attachments, or setting up real-time notifications, the SDK handles all the complexity of API communication for you.
Basic Usage
use Tigusigalpa\ManusAI\ManusAIClient; $client = new ManusAIClient('your-api-key'); // Create a task $result = $client->createTask('Write a poem about PHP programming', [ 'agentProfile' => 'manus-1.6', 'taskMode' => 'chat', ]); echo "Task created: {$result['task_id']}\n"; echo "View at: {$result['task_url']}\n";
Task Management
Tasks are the core of Manus AI - they represent AI agent work items that can perform complex operations, answer questions, or automate workflows. Each task has a lifecycle from creation through execution to completion, and you can monitor and control every step of the process.
API Documentation: Tasks API Reference
Create a Task
use Tigusigalpa\ManusAI\Helpers\AgentProfile; $task = $client->createTask('Your task prompt here', [ 'agentProfile' => AgentProfile::MANUS_1_6, // or AgentProfile::MANUS_1_6_LITE, MANUS_1_6_MAX 'taskMode' => 'agent', // 'chat', 'adaptive', or 'agent' 'locale' => 'en-US', 'hideInTaskList' => false, 'createShareableLink' => true, ]);
Available Agent Profiles:
AgentProfile::MANUS_1_6- Latest and most capable model (recommended)AgentProfile::MANUS_1_6_LITE- Faster, lightweight versionAgentProfile::MANUS_1_6_MAX- Maximum capability versionAgentProfile::SPEED- β οΈ Deprecated, useMANUS_1_6_LITEinsteadAgentProfile::QUALITY- β οΈ Deprecated, useMANUS_1_6instead
// Or use string values directly $task = $client->createTask('Your prompt', [ 'agentProfile' => 'manus-1.6', ]);
Get Task Details
$task = $client->getTask('task_id'); echo "Status: {$task['status']}\n"; echo "Credits used: {$task['credit_usage']}\n"; // Access output messages foreach ($task['output'] as $message) { echo "[{$message['role']}]: {$message['content']}\n"; }
List Tasks
$tasks = $client->getTasks([ 'limit' => 10, 'order' => 'desc', 'orderBy' => 'created_at', 'status' => ['completed', 'running'], ]); foreach ($tasks['data'] as $task) { echo "Task {$task['id']}: {$task['status']}\n"; }
Update Task
$updated = $client->updateTask('task_id', [ 'title' => 'New Task Title', 'enableShared' => true, 'enableVisibleInTaskList' => true, ]);
Delete Task
$result = $client->deleteTask('task_id'); echo "Deleted: " . ($result['deleted'] ? 'yes' : 'no') . "\n";
File Management
Manus AI supports file attachments to provide context for your tasks. The file upload process uses a two-step approach: first, create a file record to get a secure presigned URL, then upload your content directly to cloud storage. Once uploaded, files can be attached to tasks for analysis, processing, or reference.
API Documentation: Files API Reference
Upload a File
use Tigusigalpa\ManusAI\Helpers\TaskAttachment; // 1. Create file record $fileResult = $client->createFile('document.pdf'); // 2. Upload file content $fileContent = file_get_contents('/path/to/document.pdf'); $client->uploadFileContent( $fileResult['upload_url'], $fileContent, 'application/pdf' ); // 3. Use file in task $attachment = TaskAttachment::fromFileId($fileResult['id']); $task = $client->createTask('Analyze this document', [ 'attachments' => [$attachment], ]);
Different Attachment Types
use Tigusigalpa\ManusAI\Helpers\TaskAttachment; // From file ID $attachment1 = TaskAttachment::fromFileId('file_123'); // From URL $attachment2 = TaskAttachment::fromUrl('https://example.com/image.jpg'); // From base64 $attachment3 = TaskAttachment::fromBase64($base64Data, 'image/png'); // From local file path $attachment4 = TaskAttachment::fromFilePath('/path/to/file.pdf');
List Files
$files = $client->listFiles(); foreach ($files['data'] as $file) { echo "{$file['filename']} - {$file['status']}\n"; }
Delete File
$result = $client->deleteFile('file_id');
Webhooks
Webhooks enable real-time notifications about your task lifecycle events. Instead of polling for updates, Manus AI will send HTTP POST requests to your specified endpoint whenever important events occur - such as task creation or completion. This allows you to build reactive workflows, update dashboards instantly, or trigger automated actions based on task results.
Manus AI supports two key event types:
- task_created: Fired immediately when a task is created via the API
- task_stopped: Fired when a task completes successfully or requires user input
API Documentation: Webhooks Guide
Create Webhook
$webhook = $client->createWebhook([ 'url' => 'https://your-domain.com/webhook/manus-ai', 'events' => ['task_created', 'task_stopped'], ]); echo "Webhook ID: {$webhook['webhook_id']}\n";
Handle Webhook Events
use Tigusigalpa\ManusAI\Helpers\WebhookHandler; // In your webhook endpoint $payload = WebhookHandler::parsePayload($request->getContent()); if (WebhookHandler::isTaskCompleted($payload)) { $taskDetail = WebhookHandler::getTaskDetail($payload); $attachments = WebhookHandler::getAttachments($payload); echo "Task completed: {$taskDetail['task_id']}\n"; echo "Message: {$taskDetail['message']}\n"; // Download attachments foreach ($attachments as $attachment) { echo "File: {$attachment['file_name']} ({$attachment['size_bytes']} bytes)\n"; echo "URL: {$attachment['url']}\n"; } } if (WebhookHandler::isTaskAskingForInput($payload)) { // Task needs user input $taskDetail = WebhookHandler::getTaskDetail($payload); echo "Input required: {$taskDetail['message']}\n"; }
Delete Webhook
$client->deleteWebhook('webhook_id');
Laravel Integration
The SDK includes first-class Laravel support with a service provider, facade, and Artisan commands. Once configured, you can use Manus AI seamlessly within your Laravel application through dependency injection or the convenient facade.
Using Facade
use Tigusigalpa\ManusAI\Laravel\ManusAI; // Create task $result = ManusAI::createTask('Your prompt here'); // Get task $task = ManusAI::getTask('task_id'); // List tasks $tasks = ManusAI::getTasks(['limit' => 10]);
Using Dependency Injection
use Tigusigalpa\ManusAI\ManusAIClient; class TaskController extends Controller { public function create(ManusAIClient $manus) { $result = $manus->createTask('Generate report'); return response()->json([ 'task_id' => $result['task_id'], 'url' => $result['task_url'], ]); } }
Artisan Commands
Test connection:
php artisan manus-ai:test
php artisan manus-ai:test --task="Custom test prompt"
Manage tasks:
# Create task php artisan manus-ai:task create --prompt="Your prompt" --profile=manus-1.6 # List tasks php artisan manus-ai:task list --limit=10 --status=completed # Get task details php artisan manus-ai:task get --id=task_123 # Update task php artisan manus-ai:task update --id=task_123 --title="New Title" # Delete task php artisan manus-ai:task delete --id=task_123
π API Reference
ManusAIClient Methods
Task Methods
createTask(string $prompt, array $options = []): arraygetTasks(array $filters = []): arraygetTask(string $taskId): arrayupdateTask(string $taskId, array $updates): arraydeleteTask(string $taskId): array
File Methods
createFile(string $filename): arrayuploadFileContent(string $uploadUrl, string $fileContent, string $contentType): boollistFiles(): arraygetFile(string $fileId): arraydeleteFile(string $fileId): array
Webhook Methods
createWebhook(array $webhook): arraydeleteWebhook(string $webhookId): bool
Helper Classes
TaskAttachment
TaskAttachment::fromFileId(string $fileId): arrayTaskAttachment::fromUrl(string $url): arrayTaskAttachment::fromBase64(string $data, string $mimeType): arrayTaskAttachment::fromFilePath(string $path): array
AgentProfile
AgentProfile::MANUS_1_6- Latest model (recommended)AgentProfile::MANUS_1_6_LITE- Lightweight versionAgentProfile::MANUS_1_6_MAX- Maximum capability versionAgentProfile::SPEED- DeprecatedAgentProfile::QUALITY- DeprecatedAgentProfile::all(): array- Get all profilesAgentProfile::recommended(): array- Get recommended profilesAgentProfile::isValid(string $profile): boolAgentProfile::isDeprecated(string $profile): bool
WebhookHandler
WebhookHandler::parsePayload(string $json): arrayWebhookHandler::isTaskCreated(array $payload): boolWebhookHandler::isTaskStopped(array $payload): boolWebhookHandler::isTaskCompleted(array $payload): boolWebhookHandler::isTaskAskingForInput(array $payload): boolWebhookHandler::getTaskDetail(array $payload): ?arrayWebhookHandler::getAttachments(array $payload): array
π― Real-World Use Cases & Success Stories
Discover how developers and businesses are leveraging Manus AI PHP SDK to transform their applications:
π Content Generation & Marketing
Automated Blog Post Creation
$task = $client->createTask( 'Write a comprehensive 1500-word blog post about the benefits of AI in e-commerce, including SEO keywords, meta description, and engaging headlines', ['agentProfile' => AgentProfile::MANUS_1_6] );
Social Media Management
$task = $client->createTask( 'Create 10 engaging social media posts for a tech startup launching a new SaaS product. Include hashtags and call-to-action for each platform: Twitter, LinkedIn, and Instagram' );
π Business Intelligence & Data Analysis
Automated Report Generation
// Upload sales data $fileResult = $client->createFile('sales_data_q4.xlsx'); $client->uploadFileContent($fileResult['upload_url'], $fileContent, 'application/vnd.ms-excel'); // Analyze and generate report $task = $client->createTask( 'Analyze this sales data and create a comprehensive quarterly report with insights, trends, and recommendations for Q1 strategy', ['attachments' => [TaskAttachment::fromFileId($fileResult['id'])]] );
Customer Feedback Analysis
$task = $client->createTask( 'Analyze 500+ customer reviews and provide: sentiment analysis, common pain points, feature requests, and actionable recommendations for product improvement' );
π€ Customer Support Automation
Intelligent Ticket Response
// In your support ticket system $ticketContent = $ticket->getDescription(); $task = ManusAI::createTask( "Generate a professional, empathetic response to this customer support ticket: {$ticketContent}. Include troubleshooting steps and escalation options if needed." );
FAQ Generation
$task = $client->createTask( 'Based on our product documentation, create a comprehensive FAQ section with 20 common questions and detailed answers for our help center' );
οΏ½ E-commerce & Product Management
Product Description Writer
$task = $client->createTask( 'Write compelling, SEO-optimized product descriptions for: ' . json_encode($products) . '. Include features, benefits, specifications, and persuasive call-to-action.' );
Competitor Analysis
$task = $client->createTask( 'Research and analyze top 5 competitors in the project management software space. Provide pricing comparison, feature matrix, and market positioning insights.' );
π Education & E-Learning
Quiz & Assessment Generator
$task = $client->createTask( 'Create a 25-question multiple-choice quiz on PHP 8.2 features with explanations for each answer. Include beginner, intermediate, and advanced difficulty levels.' );
Personalized Learning Paths
$task = $client->createTask( "Based on student's current skill level in {$subject}, create a personalized 12-week learning roadmap with weekly goals, resources, and practice exercises." );
π§ Development & Code Assistance
Code Review & Documentation
$fileResult = $client->createFile('legacy_code.php'); $client->uploadFileContent($fileResult['upload_url'], $codeContent, 'text/plain'); $task = $client->createTask( 'Review this PHP code for: security vulnerabilities, performance issues, best practices violations, and suggest improvements with code examples', ['attachments' => [TaskAttachment::fromFileId($fileResult['id'])]] );
API Documentation Generator
$task = $client->createTask( 'Generate comprehensive API documentation for our REST endpoints including: request/response examples, authentication, error codes, and usage examples' );
π₯ Healthcare & Legal (Document Processing)
Medical Report Summarization
$task = $client->createTask( 'Summarize this medical report into patient-friendly language, highlighting key findings, recommendations, and next steps', ['attachments' => [TaskAttachment::fromFilePath('/path/to/medical_report.pdf')]] );
Contract Analysis
$task = $client->createTask( 'Analyze this contract and identify: key terms, obligations, potential risks, important dates, and clauses that require legal review', ['attachments' => [TaskAttachment::fromFileId($contractFileId)]] );
π Multilingual Applications
Translation & Localization
$task = $client->createTask( 'Translate this marketing copy into Spanish, French, German, and Japanese. Maintain tone, cultural nuances, and marketing impact in each language.' );
π§ Email Marketing Automation
Campaign Creation
$task = $client->createTask( 'Create a 5-email drip campaign for new SaaS users: welcome email, feature highlights, success stories, upgrade incentive, and feedback request. Include subject lines and optimal sending schedule.' );
οΏ½π‘ Code Examples & Tutorials
See the examples/ directory for complete working examples:
basic.php- Basic task creation and managementfile-upload.php- File upload with attachmentswebhook.php- Webhook setup and handlinglaravel-routes.php- Laravel route examplesadvanced-workflows.php- Complex multi-step AI workflowserror-handling.php- Comprehensive error handling patterns
π§ͺ Testing & Quality Assurance
Running Tests
We take code quality seriously. The SDK includes a comprehensive test suite covering all major functionality:
# Run all tests composer test # Run tests with detailed output composer test -- --verbose # Run specific test file ./vendor/bin/phpunit tests/ManusAIClientTest.php
Code Coverage
Generate detailed code coverage reports to ensure reliability:
# Generate HTML coverage report composer test-coverage # View coverage in terminal composer test -- --coverage-text
Continuous Integration
The SDK is tested against multiple PHP versions and Laravel versions to ensure compatibility:
- PHP 8.2, 8.3, 8.4
- Laravel 8.x, 9.x, 10.x, 11.x, 12.x
- Multiple operating systems (Linux, macOS, Windows)
β Frequently Asked Questions (FAQ)
General Questions
Q: Is this SDK free to use?
A: Yes! The SDK is open-source and licensed under MIT. However, you'll need a Manus AI account and API key, which may
have usage costs depending on your plan.
Q: What's the difference between this SDK and calling the API directly?
A: This SDK provides type-safe interfaces, automatic error handling, helper classes, Laravel integration, and
comprehensive documentation. It saves you hundreds of lines of boilerplate code.
Q: Can I use this in production applications?
A: Absolutely! The SDK is production-ready, battle-tested, and includes comprehensive error handling and logging
capabilities.
Q: Does this work with older PHP versions?
A: The SDK requires PHP 8.2+ to take advantage of modern PHP features like typed properties, enums, and improved type
system.
Laravel-Specific Questions
Q: Do I need Laravel to use this SDK?
A: No! The SDK works perfectly in any PHP 8.2+ application. Laravel integration is optional but provides additional
convenience features.
Q: How do I use this in Laravel Lumen?
A: Register the service provider manually in bootstrap/app.php:
$app->register(Tigusigalpa\ManusAI\Laravel\ManusAIServiceProvider::class);
Q: Can I use multiple API keys in one Laravel application?
A: Yes! Create multiple client instances with different API keys:
$client1 = new ManusAIClient('key-1'); $client2 = new ManusAIClient('key-2');
Technical Questions
Q: How do I handle rate limiting?
A: The SDK automatically includes retry logic for rate limit errors. You can also implement exponential backoff in your
application layer.
Q: What file formats are supported for uploads?
A: Manus AI supports PDF, images (JPG, PNG, GIF), documents (DOC, DOCX), spreadsheets (XLS, XLSX), and text files. Check
the official API documentation for the complete list.
Q: How long do tasks take to complete?
A: Task completion time varies based on complexity and model used. Simple tasks may complete in seconds, while complex
analysis can take minutes. Use webhooks for real-time notifications.
Q: Can I cancel a running task?
A: Currently, the Manus AI API doesn't support task cancellation. However, you can delete completed tasks to clean up
your task list.
Q: How do I handle errors and exceptions?
A: The SDK throws descriptive exceptions for all error conditions. Wrap your calls in try-catch blocks:
try { $task = $client->createTask('Your prompt'); } catch (\Exception $e) { Log::error('Manus AI Error: ' . $e->getMessage()); }
Performance & Optimization
Q: Which agent profile should I use?
A:
- MANUS_1_6: Best balance of quality and speed (recommended for most use cases)
- MANUS_1_6_LITE: Faster responses, lower cost (good for simple tasks)
- MANUS_1_6_MAX: Maximum capability (complex reasoning and analysis)
Q: How can I reduce API costs?
A: Use the Lite model for simple tasks, batch similar requests, cache results when appropriate, and use precise prompts
to avoid unnecessary iterations.
Q: Can I process multiple tasks in parallel?
A: Yes! Create multiple tasks asynchronously and use webhooks to get notified when each completes:
$tasks = []; foreach ($prompts as $prompt) { $tasks[] = $client->createTask($prompt); }
Integration Questions
Q: Can I integrate this with my existing CMS?
A: Yes! The SDK is framework-agnostic and can be integrated into WordPress, Drupal, Joomla, or any PHP-based CMS.
Q: Does this work with queued jobs?
A: Absolutely! Perfect for Laravel queues:
dispatch(new ProcessAITask($prompt));
Q: Can I use this in a REST API?
A: Yes! The SDK is perfect for building AI-powered REST APIs. See the Laravel route examples for implementation
patterns.
π§ Troubleshooting Guide
Common Issues & Solutions
Issue: "Invalid API Key" Error
Solution:
- Verify your API key is correct in
.envor configuration - Ensure there are no extra spaces or quotes around the key
- Check that your Manus AI account is active
- Regenerate your API key from the Manus AI dashboard
// Test your API key try { $client = new ManusAIClient('your-api-key'); $tasks = $client->getTasks(['limit' => 1]); echo "β API key is valid!\n"; } catch (\Exception $e) { echo "β Error: " . $e->getMessage() . "\n"; }
Issue: File Upload Fails
Solution:
- Check file size limits (typically 10MB max)
- Verify the file exists and is readable
- Ensure correct MIME type is specified
- Check your internet connection
// Debug file upload $filePath = '/path/to/file.pdf'; if (!file_exists($filePath)) { die("File not found!"); } if (!is_readable($filePath)) { die("File not readable!"); } echo "File size: " . filesize($filePath) . " bytes\n";
Issue: Webhook Not Receiving Events
Solution:
- Ensure your webhook URL is publicly accessible (not localhost)
- Verify HTTPS is enabled (required for production)
- Check your server logs for incoming requests
- Test webhook endpoint manually with curl
# Test webhook endpoint curl -X POST https://your-domain.com/webhook/manus-ai \ -H "Content-Type: application/json" \ -d '{"event":"task_stopped","data":{"task_id":"test"}}'
Issue: Task Takes Too Long
Solution:
- Use MANUS_1_6_LITE for faster responses
- Simplify your prompt to be more specific
- Break complex tasks into smaller subtasks
- Implement webhooks instead of polling
Issue: Composer Installation Fails
Solution:
# Clear Composer cache composer clear-cache # Update Composer itself composer self-update # Install with verbose output composer require tigusigalpa/manus-ai-php -vvv # Check PHP version php -v # Must be 8.2 or higher
Issue: Laravel Service Provider Not Loading
Solution:
# Clear Laravel caches php artisan config:clear php artisan cache:clear php artisan route:clear # Re-publish configuration php artisan vendor:publish --tag=manus-ai-config --force # Verify provider is registered php artisan about
Getting Help
If you encounter issues not covered here:
- Check the Examples: Review the
examples/directory for working code - Read API Docs: Visit Manus AI API Documentation
- Search Issues: Check GitHub Issues
- Ask the Community: Open a new issue with detailed information
- Contact Support: Email sovletig@gmail.com for direct assistance
Debug Mode
Enable detailed logging for troubleshooting:
// Enable Guzzle debug mode $client = new ManusAIClient('your-api-key', [ 'debug' => true, // Outputs all HTTP requests/responses ]);
β‘ Performance & Best Practices
Optimizing Your AI Workflows
1. Choose the Right Model
// For simple tasks - use Lite (faster, cheaper) $task = $client->createTask('Summarize this text in 3 sentences', [ 'agentProfile' => AgentProfile::MANUS_1_6_LITE ]); // For complex analysis - use Max (more capable) $task = $client->createTask('Perform deep competitive analysis with market insights', [ 'agentProfile' => AgentProfile::MANUS_1_6_MAX ]); // For balanced performance - use standard (recommended) $task = $client->createTask('Generate blog post with SEO optimization', [ 'agentProfile' => AgentProfile::MANUS_1_6 ]);
2. Write Effective Prompts
β Poor Prompt:
$task = $client->createTask('Write something about AI');
β Excellent Prompt:
$task = $client->createTask( 'Write a 500-word blog post about AI in healthcare. Target audience: medical professionals. Tone: professional yet accessible. Include: 3 real-world examples, statistics, and a call-to-action. SEO keywords: AI healthcare, medical AI, diagnostic automation.' );
3. Implement Caching
// Cache frequently requested content $cacheKey = 'manus_task_' . md5($prompt); if (Cache::has($cacheKey)) { return Cache::get($cacheKey); } $result = $client->createTask($prompt); Cache::put($cacheKey, $result, now()->addHours(24));
4. Use Webhooks for Long-Running Tasks
// β Polling (inefficient) do { sleep(5); $task = $client->getTask($taskId); } while ($task['status'] !== 'completed'); // β Webhooks (efficient) $webhook = $client->createWebhook([ 'url' => 'https://your-app.com/webhook', 'events' => ['task_stopped'] ]);
5. Batch Processing
// Process multiple items efficiently $taskIds = []; foreach ($items as $item) { $result = $client->createTask("Process: {$item}"); $taskIds[] = $result['task_id']; } // Handle results via webhook or batch retrieval
6. Error Handling & Retries
use Illuminate\Support\Facades\Retry; $task = Retry::times(3) ->sleep(1000) ->catch(function ($e) { Log::warning('Manus AI retry: ' . $e->getMessage()); }) ->throw(function ($e) { Log::error('Manus AI failed after retries: ' . $e->getMessage()); }) ->call(function () use ($client, $prompt) { return $client->createTask($prompt); });
7. Monitor Credit Usage
// Track API costs $task = $client->getTask($taskId); $creditsUsed = $task['credit_usage']; Log::info("Task {$taskId} used {$creditsUsed} credits"); // Alert on high usage if ($creditsUsed > 100) { Notification::send($admin, new HighCreditUsageAlert($taskId)); }
Security Best Practices
1. Secure API Key Storage
// β Use environment variables $client = new ManusAIClient(env('MANUS_AI_API_KEY')); // β Never hardcode $client = new ManusAIClient('sk-abc123...'); // DON'T DO THIS!
2. Validate User Input
// Sanitize prompts from user input $userPrompt = strip_tags($request->input('prompt')); $userPrompt = substr($userPrompt, 0, 5000); // Limit length $task = $client->createTask($userPrompt);
3. Implement Rate Limiting
// Laravel rate limiting Route::middleware('throttle:10,1')->post('/api/ai-task', function (Request $request) { return ManusAI::createTask($request->input('prompt')); });
4. Webhook Signature Verification
// Verify webhook authenticity (implement based on your security needs) public function handleWebhook(Request $request) { $signature = $request->header('X-Manus-Signature'); if (!$this->verifySignature($signature, $request->getContent())) { abort(403, 'Invalid signature'); } // Process webhook... }
π€ Contributing to the Project
We love contributions! Whether you're fixing bugs, adding features, or improving documentation, your help makes this SDK better for everyone.
How to Contribute
1. Fork & Clone
# Fork the repository on GitHub, then: git clone https://github.com/YOUR-USERNAME/manus-ai-php.git cd manus-ai-php composer install
2. Create a Feature Branch
git checkout -b feature/amazing-new-feature
# or
git checkout -b bugfix/fix-important-issue
3. Make Your Changes
- Write clean, documented code
- Follow PSR-12 coding standards
- Add tests for new features
- Update documentation as needed
4. Run Tests
# Ensure all tests pass composer test # Check code style composer phpcs # Fix code style automatically composer phpcbf
5. Commit Your Changes
git add . git commit -m "feat: Add amazing new feature" # Use conventional commit messages: # feat: New feature # fix: Bug fix # docs: Documentation changes # test: Test additions/changes # refactor: Code refactoring
6. Push & Create Pull Request
git push origin feature/amazing-new-feature
Then open a Pull Request on GitHub with:
- Clear description of changes
- Link to related issues
- Screenshots (if applicable)
- Test results
Contribution Guidelines
Code Standards
- PHP 8.2+: Use modern PHP features (typed properties, enums, etc.)
- Type Safety: Always use type hints and return types
- Documentation: PHPDoc blocks for all public methods
- Testing: Maintain 100% code coverage for new features
- PSR-12: Follow PHP-FIG coding standards
What We're Looking For
π― High Priority:
- Bug fixes with test cases
- Performance improvements
- Documentation enhancements
- New helper methods
- Additional examples
π‘ Feature Ideas:
- Streaming response support
- Advanced caching strategies
- Batch operation helpers
- Additional Laravel integrations
- Symfony bundle support
π Documentation:
- Tutorial articles
- Video guides
- Translation to other languages
- Real-world case studies
Code Review Process
- Automated Checks: CI/CD runs tests and code quality checks
- Maintainer Review: Core team reviews code and provides feedback
- Iteration: Address feedback and update PR
- Merge: Once approved, your contribution is merged!
Development Setup
# Install dependencies composer install # Copy environment file cp .env.example .env # Add your test API key echo "MANUS_AI_API_KEY=your-test-key" >> .env # Run tests composer test # Run tests with coverage composer test-coverage # Check code style composer phpcs # Fix code style composer phpcbf
Running Examples
# Test basic functionality php examples/basic.php # Test file uploads php examples/file-upload.php # Test webhooks php examples/webhook.php
Community Guidelines
- Be Respectful: Treat everyone with respect and kindness
- Be Constructive: Provide helpful feedback and suggestions
- Be Patient: Maintainers are volunteers with limited time
- Be Collaborative: Work together to find the best solutions
Recognition
Contributors are recognized in:
- GitHub contributors page
- Release notes
- Project documentation
- Special thanks section
Questions?
- π¬ Open a Discussion
- π Report Issues
- π§ Email: sovletig@gmail.com
πΊοΈ Roadmap & Future Plans
We're constantly improving the SDK based on community feedback and emerging AI capabilities. Here's what's on the horizon:
π Upcoming Features (v2.0)
Q1 2026:
- β¨ Streaming Responses: Real-time task output streaming for interactive applications
- π Async/Promise Support: Non-blocking operations with ReactPHP integration
- π Advanced Analytics: Built-in usage tracking and cost optimization tools
- π¨ Response Formatters: Automatic parsing of JSON, Markdown, and structured outputs
Q2 2026:
- π Symfony Bundle: Native Symfony framework integration
- π WordPress Plugin: Easy integration for WordPress developers
- π± Mobile SDK Companion: Complementary mobile SDK documentation
- π§© Plugin System: Extensible architecture for custom integrations
Q3 2026:
- π€ AI Workflow Builder: Visual workflow designer for complex AI pipelines
- π Performance Dashboard: Real-time monitoring and optimization insights
- π Enhanced Security: OAuth support and advanced authentication options
- π Multi-Region Support: Automatic region selection for optimal performance
π‘ Community Requests
Vote on features you'd like to see:
- GraphQL API support
- Batch file upload optimization
- Custom model fine-tuning integration
- Advanced prompt templates library
- Integration with popular CMS platforms
- Docker container for local development
Want to influence the roadmap? Open a feature request or vote on existing proposals!
π Comparison with Alternatives
Why Choose Manus AI PHP SDK?
| Feature | Manus AI PHP SDK | Direct API Calls | Other SDKs |
|---|---|---|---|
| Type Safety | β Full PHP 8.2+ types | β Manual typing | β οΈ Partial |
| Laravel Integration | β Native support | β Manual setup | β οΈ Limited |
| Error Handling | β Comprehensive | β Manual | β οΈ Basic |
| Helper Classes | β Rich utilities | β None | β οΈ Few |
| Documentation | β Extensive | β οΈ API docs only | β οΈ Limited |
| Active Maintenance | β Regular updates | N/A | β οΈ Varies |
| Test Coverage | β 100% | β N/A | β οΈ Varies |
| Community Support | β Active | β None | β οΈ Limited |
| Examples & Tutorials | β Comprehensive | β None | β οΈ Basic |
| Webhook Helpers | β Built-in | β Manual | β None |
π License
This project is open-source and licensed under the MIT License - see the LICENSE file for complete details.
What This Means For You
β
Commercial Use: Use in commercial projects without restrictions
β
Modification: Modify the code to fit your needs
β
Distribution: Distribute your modified versions
β
Private Use: Use privately without disclosure
β
No Warranty: Provided "as-is" without warranty
π Important Links & Resources
Official Resources
- π Manus AI Official Website - Learn about Manus AI platform
- π Manus AI API Documentation - Complete API reference
- π Get Your API Key - Start building today
SDK Resources
- π» GitHub Repository - Source code and development
- π¦ Packagist Package - Composer installation
- π Issue Tracker - Report bugs and request features
- π¬ Discussions - Community support and ideas
- π Wiki - Comprehensive guides and tutorials
- π Changelog - Version history
Connect:
- π GitHub: @tigusigalpa
- π§ Email: sovletig@gmail.com
Other Projects:
- π CoinMarketCap PHP SDK
- π§ More projects on GitHub
π Acknowledgments & Credits
Special Thanks
Manus AI Team - For creating an exceptional AI agent platform and providing excellent API documentation
PHP Community - For continuous inspiration and best practices that shaped this SDK
Laravel Community - For feedback on Laravel integration features
Early Adopters - Developers who tested early versions and provided invaluable feedback
Contributors - Everyone who submitted pull requests, reported issues, or improved documentation
Built With
- π PHP 8.2+ - Modern PHP features and performance
- π Guzzle HTTP - Reliable HTTP client for API communication
- π¨ Laravel - Optional but powerful framework integration
- π§ͺ PHPUnit - Comprehensive testing framework
- π PHPStan - Static analysis for code quality
- π― PHP-CS-Fixer - Code style consistency
Inspired By
This SDK follows best practices from leading PHP packages:
- Laravel's elegant API design
- Symfony's robust architecture
- Guzzle's flexible HTTP handling
- Stripe PHP's developer experience
π Start Building Today!
Ready to transform your PHP applications with AI? Get started in 3 simple steps:
# 1. Install the SDK composer require tigusigalpa/manus-ai-php # 2. Set your API key export MANUS_AI_API_KEY="your-api-key-here" # 3. Create your first AI task php -r "require 'vendor/autoload.php'; use Tigusigalpa\ManusAI\ManusAIClient; \$client = new ManusAIClient(getenv('MANUS_AI_API_KEY')); \$result = \$client->createTask('Hello, AI world!'); echo 'Task created: ' . \$result['task_url'] . PHP_EOL;"
Join Our Growing Community
- β Star the repo on GitHub to show your support
- π Watch for updates to stay informed about new features
- π€ Contribute to make the SDK even better
- π’ Share with fellow PHP developers
Empowering PHP developers to build intelligent applications
Keywords for SEO
PHP AI SDK, Manus AI PHP, Laravel AI integration, PHP artificial intelligence, AI agent PHP, PHP machine learning, AI automation PHP, PHP chatbot SDK, Laravel AI package, PHP AI library, Manus AI wrapper, PHP AI API, intelligent PHP applications, AI-powered PHP, PHP AI development, Laravel AI tools, PHP AI framework, automated AI tasks PHP, PHP AI integration, Laravel machine learning