Weave Code
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

Symfony Amazeeai Configure Laravel Package

amazeeio/symfony-amazeeai-configure

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. 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],
    
  2. First Use Case: Trigger the configuration command with your email:

    php bin/console ai:amazee:configure user@example.com
    
    • A PIN will be sent to your email.
    • Enter the PIN when prompted to generate credentials.
    • Credentials are auto-populated in .env.local.

Where to Look First

  • Command Help: Run php bin/console ai:amazee:configure --help to see available options (e.g., -a for API environment).
  • Environment Variables: Check .env.local for generated keys (e.g., AMAZEEAI_LLM_KEY, AMAZEEAI_VDB_PASSWORD).
  • Symfony Secrets: Ensure sensitive vars are stored securely via Symfony’s secrets management.

Implementation Patterns

Workflow Integration

  1. 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"
        ]
    }
    
    • Automates credential setup during project initialization.
  2. 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
    
    • Ideal for multi-environment setups (e.g., local/dev/prod).
  3. Secrets Management: Store generated credentials in Symfony’s secrets system:

    # config/packages/security.yaml
    services:
        AmazeeIo\AmazeeAiConfigure\SecretHandler:
            arguments:
                $secretManager: '@security.secret_manager'
    

Integration Tips

  • Dependency Injection: Inject the configured client into services:

    use AmazeeIo\AmazeeAiConfigure\Client\AmazeeAiClient;
    
    class MyService {
        public function __construct(private AmazeeAiClient $client) {}
    }
    
    • The client auto-loads credentials from .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
    

Gotchas and Tips

Pitfalls

  1. Email Delays:

    • PIN emails may take 1–2 minutes to arrive. Use -v for verbose output to track API calls:
      php bin/console ai:amazee:configure user@example.com -vv
      
  2. Environment Mismatches:

    • Ensure .env.local is not committed. Use .env.example for templates:
      # .env.example
      AMAZEEAI_LLM_KEY=sk-your-key
      
  3. Symfony Secrets:

    • Forgetting to mark secrets as sensitive will expose them in logs:
      # config/packages/security.yaml
      security:
          secret_manager:
              secrets:
                  AMAZEEAI_LLM_KEY: ~
      

Debugging

  1. API Failures:

    • Check the AMAZEEAI_LLM_API_URL in .env.local matches the -a flag.
    • Enable HTTP debug with Symfony’s HttpClient:
      $client = new \Symfony\Contracts\HttpClient\HttpClient(
          ['debug' => true]
      );
      
  2. PIN Expiry:

    • PINs expire after 10 minutes. Regenerate with the same command.

Extension Points

  1. 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;
        }
    }
    
  2. 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
    
  3. 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();
    

Tips

  • 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).

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.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle