amazeeio/symfony-amazeeai-configure
amazee.ai, the pattern (email-based auth → API key generation → env var injection) is reusable for other AI providers (e.g., OpenAI, Mistral). This could justify a custom wrapper layer in Laravel to standardize the flow.dev/stage/prod environments via CLI flags, which aligns with Laravel’s .env ecosystem but requires manual mapping (e.g., translating -a dev.api.example.com to AMAZEEAI_LLM_API_URL=https://dev.api.example.com).symfony/console). Workarounds:
shell_exec('symfony console ai:amazee:configure ...')), but this introduces security/permission risks and tight coupling.Artisan::call() or a custom command, but this duplicates effort and diverges from upstream updates.symfony/http-client: Replaceable with Laravel’s Http facade or Guzzle.symfony/process: Only needed for CLI execution; avoidable in Laravel.symfony/dotenv: Laravel already handles .env natively.config/caching, env encryption).AmazeeAiConfigurator::configure()).config() to toggle between amazee.ai and alternative providers..env.local writes and Symfony secrets integration don’t conflict with Laravel’s Vapor/Envoy deployments.AMAZEEAI_LLM_KEY and AMAZEEAI_VDB_PASSWORD stored in production? Laravel’s env() + Vapor/Hashicorp Vault may conflict with Symfony’s secrets system.bundles.php, run CLI command).// app/Console/Commands/ConfigureAmazeeAi.php
public function handle() {
$email = $this->ask('Enter email for amazee.ai auth');
$exitCode = shell_exec("symfony console ai:amazee:configure {$email} -a {$this->option('env')}");
if ($exitCode !== 0) { throw new \RuntimeException('Configuration failed'); }
}
symfony/console app in /vendor/bin/symfony.Process::fromShellCommandline().Mail, Http, and Artisan.// app/Services/AmazeeAiConfigurator.php
public function configure(string $email): void {
$pin = $this->sendAuthEmail($email);
$apiKey = $this->exchangePinForKey($pin);
putenv("AMAZEEAI_LLM_KEY={$apiKey}");
file_put_contents('.env.local', "AMAZEEAI_LLM_KEY={$apiKey}\n", FILE_APPEND);
}
.env.local writes and Symfony secrets compatibility.AmazeeAiClient).// app/Services/AmazeeAiClient.php
public function configure(string $email, string $apiEnv = 'prod'): void {
$process = new Process(['symfony', 'console', 'ai:amazee:configure', $email, '-a', $apiEnv]);
$process->run();
if (!$process->isSuccessful()) { throw new \RuntimeException($process->getErrorOutput()); }
}
Dockerfile or server setup:
RUN curl -sS https://get.symfony.com/cli/installer | bash
README.md.env() caching. Use env:refresh post-configuration or avoid .env.local in favor of Laravel’s config().ai:amazee:configure command must be namespaced to avoid collisions (e.g., amazee:ai:configure).composer.json.composer require amazeeio/symfony-amazeeai-configure)../vendor/bin/symfony console ai:amazee:configure test@example.com)..env.local is excluded from version control (add to .gitignore).composer.json until stability is confirmed.env() system may need manual refreshes or a custom config/caching bypass.config() with runtime overrides for sensitive values.log/laravel.log. Redirect output to a file or use Process::mustRun() for exceptions.How can I help you explore Laravel packages today?