Certificate manager built on Laravel 13, Livewire 4, and Flux. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Ocr;
|
|
|
|
use App\Ocr\Providers\KlippaProvider;
|
|
use App\Ocr\Providers\MistralProvider;
|
|
use App\Ocr\Providers\NoneProvider;
|
|
use Illuminate\Support\Manager;
|
|
|
|
/**
|
|
* Resolves OCR providers by name (driver). The active provider is chosen
|
|
* per-user from their `ocr_provider` setting, and the API key is supplied
|
|
* per call, so the resolved drivers are stateless and safely cached.
|
|
*
|
|
* @method OcrProviderInterface driver(string|null $driver = null)
|
|
*/
|
|
class OcrManager extends Manager
|
|
{
|
|
public function getDefaultDriver(): string
|
|
{
|
|
return 'none';
|
|
}
|
|
|
|
public function createNoneDriver(): OcrProviderInterface
|
|
{
|
|
return new NoneProvider;
|
|
}
|
|
|
|
public function createKlippaDriver(): OcrProviderInterface
|
|
{
|
|
return new KlippaProvider;
|
|
}
|
|
|
|
public function createMistralDriver(): OcrProviderInterface
|
|
{
|
|
return new MistralProvider;
|
|
}
|
|
|
|
/**
|
|
* @return array<int, string>
|
|
*/
|
|
public static function availableProviders(): array
|
|
{
|
|
return ['none', 'klippa', 'mistral'];
|
|
}
|
|
}
|