mosparo/php-api-client
PHP API client for mosparo spam protection. Connect to a mosparo instance, send verification requests for form submissions, handle validation results, and integrate bot protection into your PHP/Laravel apps with a simple, lightweight client.
Illuminate\Http\Client) or Guzzle (if bundled)..env for Mosparo API keys)..env)?Http facade or Guzzle for flexibility.config/services.php or .env.$this->app->singleton(MosparoClient::class, function ($app) {
return new \Mosparo\Client($app['config']['services.mosparo.api_key']);
});
composer require mosparo/php-api-client
app/Services/MosparoService.php).config/services.php:
'mosparo' => [
'api_key' => env('MOSPARO_API_KEY'),
'endpoint' => env('MOSPARO_ENDPOINT', 'https://api.mosparo.org'),
],
AppServiceProvider:
$this->app->bind(MosparoService::class, function ($app) {
return new MosparoService(new \Mosparo\Client($app['config']['services.mosparo.api_key']));
});
failed event or a monitoring tool like Sentry).composer.json constraints).v1) to avoid breaking changes.mosparo/php-api-client:^1.0).guzzlehttp/guzzle).update command with --dry-run to test updates.composer.json to avoid surprises:
"mosparo/php-api-client": "^1.0.0"
MOSPARO_INTEGRATION.md with:
try {
$response = $mosparoClient->verify($data);
} catch (\Mosparo\Exception $e) {
\Log::error("Mosparo API failed: " . $e->getMessage());
// Fallback: Use a cached response or alternative logic
}
retry-after middleware or exponential backoff.$cacheKey = "mosparo_verification_{$userId}";
return Cache::remember($cacheKey, now()->addMinutes(5), function () use ($data) {
return $mosparoClient->verify($data);
});
How can I help you explore Laravel packages today?