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

Dev Tools Laravel Package

campaignchain/dev-tools

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. Installation:

    composer require campaignchain/dev-tools
    composer update
    

    Add to app/AppKernel.php:

    new CampaignChain\GeneratorBundle\CampaignChainGeneratorBundle(),
    
  2. First Use Case: Run the generator via CLI:

    php app/console campaignchain:generate:module
    

    Follow the interactive prompts (module name, identifier, description, vendor details, etc.).

  3. Where to Look First:

    • CLI Command: php app/consolecampaignchain:generate:module
    • Generated Files: Check src/ for new bundle structure (e.g., Vendor/ModuleBundle/).
    • Documentation: CampaignChain Dev Docs for module conventions.

Implementation Patterns

Interactive Workflow

  1. Prompt-Driven Generation:

    • Run campaignchain:generate:module and answer prompts sequentially (e.g., namespace, license, dependencies).
    • Example:
      Module name [MyModule]: UserManagement
      Module identifier [user_management]: user_management
      Bundle namespace [CampaignChain\UserManagementBundle]: AppBundle\UserManagementBundle
      
  2. Composer Integration:

    • Generates a composer.json snippet for the module under Resources/config/composer.json.
    • Manually merge into your project’s composer.json or use --composer flag (if supported) to auto-register.
  3. Bundle Structure:

    • Follows Symfony bundle conventions:
      src/
      ├── Vendor/
      │   └── ModuleBundle/
      │       ├── Controller/
      │       ├── DependencyInjection/
      │       │   ├── ModuleExtension.php
      │       │   └── module.services.yml
      │       ├── Resources/
      │       │   ├── config/
      │       │   │   └── services.yml
      │       │   └── views/
      │       └── ModuleBundle.php
      
  4. Extending Generation:

    • Override default templates by copying files from vendor/campaignchain/dev-tools/templates/ to app/Resources/CampaignChainGeneratorBundle/templates/.
  5. Post-Generation Tasks:

    • Register the bundle in AppKernel.php:
      new Vendor\ModuleBundle\ModuleBundle(),
      
    • Update autoload_psr4.php if namespaces aren’t auto-detected:
      'Vendor\\ModuleBundle\\' => [__DIR__.'/../src/Vendor/ModuleBundle'],
      

Gotchas and Tips

Pitfalls

  1. Namespace Collisions:

    • Ensure the generated namespace (Vendor\ModuleBundle) doesn’t conflict with existing bundles.
    • Fix: Adjust the --namespace flag during generation or manually rename the directory.
  2. Composer Autoload Issues:

    • If classes aren’t autoloaded, run:
      composer dump-autoload
      
    • Verify autoload_psr4.php includes the new namespace.
  3. Symfony Version Mismatch:

    • The generator assumes Symfony 2.x/3.x conventions. For Symfony 4/5, manually adjust:
      • Move bundles to config/bundles.php.
      • Update services.yml to use Symfony’s autowiring.
  4. Missing Dependencies:

    • If the module requires other bundles (e.g., DoctrineBundle), add them to:
      • The generated composer.json (merge manually).
      • config/bundles.php (Symfony 4+) or AppKernel.php.
  5. Template Overrides Not Working:

    • Ensure custom templates in app/Resources/CampaignChainGeneratorBundle/templates/ match the generator’s expected structure.
    • Debug: Check the generator’s logs or add debug:config to verify paths.

Debugging Tips

  • Dry Run: Use --dry-run (if supported) to preview generated files without writing.
  • Logs: Enable Symfony debug mode (APP_DEBUG=1) to see generator output:
    php app/console campaignchain:generate:module --debug
    
  • Manual Verification: Compare generated files against CampaignChain’s module template.

Extension Points

  1. Custom Templates:

    • Override default templates (e.g., ModuleBundle.php, services.yml) by placing copies in:
      app/Resources/CampaignChainGeneratorBundle/templates/
      
    • Example: Add a custom README.md template.
  2. Pre/Post-Generation Hooks:

    • Extend the generator by subclassing CampaignChain\GeneratorBundle\Generator\ModuleGenerator and overriding methods like generateBundle().
    • Bind your service in services.yml:
      campaignchain.generator.module:
          class: Your\CustomModuleGenerator
          tags: [campaignchain.generator]
      
  3. Adding New Prompts:

    • Extend the interactive questions by modifying the generator’s QuestionHelper or adding new options to the CLI command.
  4. Composer Script Integration:

    • Use post-update-cmd in composer.json to auto-register generated modules:
      "scripts": {
          "post-update-cmd": [
              "php bin/console campaignchain:generate:module --composer"
          ]
      }
      
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.
anousss007/vigilance
supportpal/eloquent-model
ardenexal/fhir-models
laravel-at/laravel-image-sanitize
romalytar/yammi-audit-log-laravel
ardenexal/fhir-validation
arshaviras/weather-widget
laravel-chronicle/core
sunchayn/nimbus
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon