amazeeio/symfony-amazeeai-configure
Installation:
Add the repository to composer.json and install:
composer require amazeeio/symfony-amazeeai-configure
Register the bundle in config/bundles.php if not using Symfony Flex:
AmazeeIo\AmazeeAiConfigure\AmazeeAiConfigureBundle::class => ['all' => true],
First Use Case: Trigger the configuration command with your email:
php bin/console ai:amazee:configure user@example.com
.env.local.php bin/console ai:amazee:configure --help to see available options (e.g., -a for API environment)..env.local for generated keys (e.g., AMAZEEAI_LLM_KEY, AMAZEEAI_VDB_PASSWORD).Onboarding New Projects:
Add the command to your deployment script or post-install-cmd in composer.json:
"scripts": {
"post-install-cmd": [
"@symfony-cmd",
"ai:amazee:configure user@example.com"
]
}
Environment-Specific Config:
Use the -a flag to target dev/stage APIs:
php bin/console ai:amazee:configure user@example.com -a dev.api.example.com
Secrets Management: Store generated credentials in Symfony’s secrets system:
# config/packages/security.yaml
services:
AmazeeIo\AmazeeAiConfigure\SecretHandler:
arguments:
$secretManager: '@security.secret_manager'
Dependency Injection: Inject the configured client into services:
use AmazeeIo\AmazeeAiConfigure\Client\AmazeeAiClient;
class MyService {
public function __construct(private AmazeeAiClient $client) {}
}
.env.Validation:
Add a pre-commit hook to validate .env.local for required keys:
grep -q "AMAZEEAI_LLM_KEY" .env.local || exit 1
CI/CD: Use the command in pipelines to auto-configure credentials for test environments:
# .github/workflows/deploy.yml
- run: php bin/console ai:amazee:configure ci@example.com -a stage.api.amazee.ai
Email Delays:
-v for verbose output to track API calls:
php bin/console ai:amazee:configure user@example.com -vv
Environment Mismatches:
.env.local is not committed. Use .env.example for templates:
# .env.example
AMAZEEAI_LLM_KEY=sk-your-key
Symfony Secrets:
# config/packages/security.yaml
security:
secret_manager:
secrets:
AMAZEEAI_LLM_KEY: ~
API Failures:
AMAZEEAI_LLM_API_URL in .env.local matches the -a flag.HttpClient:
$client = new \Symfony\Contracts\HttpClient\HttpClient(
['debug' => true]
);
PIN Expiry:
Custom PIN Handling: Override the PIN validation logic by extending the command:
use AmazeeIo\AmazeeAiConfigure\Command\ConfigureCommand;
class CustomConfigureCommand extends ConfigureCommand {
protected function validatePin(string $pin): bool {
// Custom logic (e.g., check against a database)
return true;
}
}
Multi-User Support:
Extend the command to accept a --role flag for role-based access control (RBAC):
php bin/console ai:amazee:configure user@example.com --role=admin
Webhook Integration:
Use Symfony’s Process component to trigger the command via a webhook:
use Symfony\Component\Process\Process;
$process = new Process(['php', 'bin/console', 'ai:amazee:configure', 'webhook@example.com']);
$process->run();
Local Development:
Use dev.api.amazee.ai for testing to avoid hitting rate limits on prod.
Team Collaboration:
Document the PIN process in your CONTRIBUTING.md for open-source projects.
Backup Credentials:
Store backups of .env.local in a secure password manager (e.g., 1Password).
How can I help you explore Laravel packages today?