Download the PHP package refinder/laravel-sdk without Composer
On this page you can find all versions of the php package refinder/laravel-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-sdk
Refinder Laravel SDK
Official Laravel SDK for Refinder AI Tools
SEO automation and AI-powered content optimization for Laravel applications.
Installation • Quick Start • SEO Tool • API Reference • Error Handling • Testing
Overview
The Refinder Laravel SDK is a first-party Laravel package that integrates your application with the Refinder AI Tools platform. It provides:
- A clean Facade (
Refinder) for quick access to all features - Fully typed DTOs for all requests and responses
- Automatic authentication via API key (
X-API-Keyheader) - Built-in error handling with a custom exception hierarchy
- Event dispatching for tool executions (success & failure)
- Caching support for identical tool inputs
- Usage tracking helpers for monitoring quotas
- Full IDE autocompletion support via PHPDoc annotations
What Does the Refinder API Do?
Refinder AI Tools is an AI middleware platform that provides AI-powered tools as a service:
- Abstracts multiple LLM providers (OpenAI, DeepSeek, Alibaba Cloud Qwen, etc.) behind a unified interface
- Provides pluggable AI tools (starting with SEO)
- Manages subscriptions, usage quotas, and rate limiting
- Returns structured JSON outputs from all tools
Requirements
| Requirement | Version |
|---|---|
| PHP | >= 8.2 |
| Laravel | 11.x or 12.x |
| Guzzle | >= 7.0 |
Installation
The package auto-registers its service provider and facade via Laravel's package discovery.
Publish Configuration
This creates config/refinder.php with all available options.
Environment Variables
Add the following to your .env file:
Required: Only
REFINDER_API_KEYis required. All other values have sensible defaults.
Quick Start
Configuration
The full configuration file (config/refinder.php):
SEO Tool
The SEO tool is the primary feature of the Refinder platform. It analyzes content and generates comprehensive SEO recommendations.
Input Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
content |
string |
Yes | — | Text content to analyze (min 10 chars) |
url |
string |
No | null |
Page URL for additional context |
content_type |
string |
No | "page" |
One of: article, product, service, page, blog |
language |
string |
No | "en" |
Target language code (e.g., en, ar, fr) |
depth |
string |
No | "advanced" |
Analysis depth: basic, advanced, technical |
target_keywords |
array |
No | [] |
Specific keywords to optimize around |
brand_name |
string |
No | null |
Brand name for meta titles/headings |
industry |
string |
No | null |
Industry context for better optimization |
Depth Levels
| Level | Includes |
|---|---|
| basic | Meta title, meta description, primary keywords |
| advanced | Everything in basic + secondary/long-tail keywords, content analysis, heading suggestions, optimization suggestions, SEO scores |
| technical | Everything in advanced + schema markup, Open Graph tags, canonical URLs, content gap analysis |
Using the SeoInput DTO
Shorthand Methods
Working with SEO Output
API Reference
Platform Information
Subscription Details
Usage Statistics
Execution History
Available Tools
Error Handling
The SDK throws specific exception types for different error scenarios:
Exception Properties
| Exception | Extra Properties |
|---|---|
RefinderException |
errorCode, httpStatus |
ValidationException |
errors (array of field errors) |
RateLimitException |
limit, current |
ToolException |
executionId (UUID for debugging) |
Error Handling Example
Error Codes Reference
| HTTP | Code | Description |
|---|---|---|
| 401 | MISSING_API_KEY |
No API key in request header |
| 401 | INVALID_API_KEY |
API key doesn't match any active key |
| 401 | API_KEY_EXPIRED |
API key has expired |
| 403 | PLATFORM_INACTIVE |
Platform is disabled |
| 403 | NO_ACTIVE_SUBSCRIPTION |
No active subscription |
| 403 | SUBSCRIPTION_EXPIRED |
Subscription has expired |
| 403 | TOOL_NOT_ALLOWED |
Plan doesn't include this tool |
| 404 | TOOL_NOT_FOUND |
Tool slug doesn't exist |
| 404 | EXECUTION_NOT_FOUND |
Execution UUID not found |
| 422 | VALIDATION_ERROR |
Input validation failed |
| 429 | DAILY_LIMIT_EXCEEDED |
Daily quota exceeded |
| 429 | MONTHLY_LIMIT_EXCEEDED |
Monthly quota exceeded |
| 500 | TOOL_ERROR |
Tool execution error |
| 502 | LLM_ERROR |
AI provider returned an error |
Events
When config('refinder.events') is true (default), the package dispatches Laravel events:
ToolExecuted
Dispatched after a successful tool execution:
ToolExecutionFailed
Dispatched after a failed tool execution:
RateLimitApproaching
Dispatched when usage approaches the limit:
Caching
Enable response caching for identical tool inputs:
- Uses Laravel's default cache driver
- Cache keys are generated from
prefix + tool_slug + md5(input) - Only successful executions are cached (never failures)
- TTL is in minutes
Rate Limiting & Quotas
The Refinder API enforces quotas based on your subscription plan:
| Limit | Reset Period |
|---|---|
| Daily | Midnight UTC |
| Monthly | 1st of month |
Checking Quota Usage
Testing
The SDK provides a RefinderFake class for testing:
Basic Fake
Custom Fake Responses
Assertions
Real-World Examples
E-Commerce Product SEO
Batch Processing with Queue
Admin Dashboard Integration
Package Structure
Authentication
Every request to the Refinder API includes the platform's API key automatically:
| Property | Value |
|---|---|
| Prefix | rfnd_ |
| Total length | 53 characters |
| Format | rfnd_ + 48 alphanumeric characters |
The API key is read from config('refinder.api_key') and attached to every HTTP request by the RefinderClient.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Security
If you discover a security vulnerability, please send an email to [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see LICENSE for more information.
Built with care by the Refinder AI Tools team.
All versions of laravel-sdk with dependencies
illuminate/support Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
guzzlehttp/guzzle Version ^7.0