Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
add-provider-driver
mtubis/html-translator-laravel
claude-code
provider-drivers
adapters
config
testing
http-fake
env-vars

Use when adding or changing a provider driver in config/html-translator.php (openai, anthropic, ollama, openai_compatible, laravel_ai, …) or when the core adds a new chat model adapter or preset that the Laravel package should expose.

Install
php artisan boost:add-skill mtubis/html-translator-laravel

Save this content to: .claude/skills/add-provider-driver/SKILL.md

# Add or change a provider driver

A driver maps a config entry to a core chat model or provider. The package never implements vendor HTTP itself (ADR-0002): if the vendor needs a new adapter, that is a core issue first (core skill `add-translation-provider`).

1. Read the core adapter and its config class in `vendor/mtubis/html-translator/src/Provider/Llm/Bridge/` and the matching section of `vendor/mtubis/html-translator/docs/providers.md`. List every constructor/preset parameter, its type and default.
2. Design the config entry: snake_case keys mirroring the core parameter names (`base_url`, `max_tokens_field`, `refusal_fallbacks`), env variables for secrets and models, sensible defaults matching the core. Add the entry (or a commented example) to `config/html-translator.php` with a one-line comment per non-obvious key.
3. Unit tests first in `tests/Unit/Config/ChatModelFactoryTest.php`: valid entry → expected core config values; missing required keys name the env variable; wrong types and unknown enum values name the full key; secrets never appear in messages.
4. Implement the mapping in `Config\ChatModelFactory` (and `ProviderFactory` if it is not an LLM driver). Read values only through `ConfigReader`. Re-throw core `InvalidArgumentException` as `InvalidConfigurationException` with the key.
5. Feature test with `Http::fake()` and a canned vendor response (copy the shape from the core's `tests/Unit/Provider/Llm/Bridge/*/Fixtures/success.json`): `HtmlTranslation::provider('<name>')->translate('<p>Hello</p>', 'de')` produces translated HTML; `Http::assertSent()` checks URL and auth header name (not value).
6. Integration test in `tests/Integration/` with `#[Group('integration')]`, skipped without the env variable; add the variable to `.env.dist`.
7. Update the README providers table and `html-translator:check` expectations. `composer check` green.

Add or change a provider driver

A driver maps a config entry to a core chat model or provider. The package never implements vendor HTTP itself (ADR-0002): if the vendor needs a new adapter, that is a core issue first (core skill add-translation-provider).

  1. Read the core adapter and its config class in vendor/mtubis/html-translator/src/Provider/Llm/Bridge/ and the matching section of vendor/mtubis/html-translator/docs/providers.md. List every constructor/preset parameter, its type and default.
  2. Design the config entry: snake_case keys mirroring the core parameter names (base_url, max_tokens_field, refusal_fallbacks), env variables for secrets and models, sensible defaults matching the core. Add the entry (or a commented example) to config/html-translator.php with a one-line comment per non-obvious key.
  3. Unit tests first in tests/Unit/Config/ChatModelFactoryTest.php: valid entry → expected core config values; missing required keys name the env variable; wrong types and unknown enum values name the full key; secrets never appear in messages.
  4. Implement the mapping in Config\ChatModelFactory (and ProviderFactory if it is not an LLM driver). Read values only through ConfigReader. Re-throw core InvalidArgumentException as InvalidConfigurationException with the key.
  5. Feature test with Http::fake() and a canned vendor response (copy the shape from the core's tests/Unit/Provider/Llm/Bridge/*/Fixtures/success.json): HtmlTranslation::provider('<name>')->translate('<p>Hello</p>', 'de') produces translated HTML; Http::assertSent() checks URL and auth header name (not value).
  6. Integration test in tests/Integration/ with #[Group('integration')], skipped without the env variable; add the variable to .env.dist.
  7. Update the README providers table and html-translator:check expectations. composer check green.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle