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

Core Bundle Laravel Package

c33s/core-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. Installation:

    wget https://raw.githubusercontent.com/c33s/CoreBundle/master/Resources/files/composer-example.yml -O composer.yml
    touch composer.json
    composer-ya.../composer-yaml.phar convert composer.yml composer.json
    composer install
    
  2. First Use Case:

    • Navigate to config/ and locate core_bundle.yml (auto-generated or manually created).
    • Define your base configuration (e.g., routes, assets, or bundles) in composer.yml and convert it to JSON.
    • Run php bin/console c33s:core:init to scaffold a basic Laravel-like structure (if applicable; verify via docs).

Where to Look First

  • composer.yml: Primary config file (YAML format). Use composer-ya.../composer-yaml.phar convert to sync changes.
  • config/core_bundle.yml: Generated or manually defined bundle settings (e.g., asset paths, route prefixes).
  • Resources/files/: Predefined templates (e.g., composer-example.yml) for quick setup.

Implementation Patterns

Workflows

  1. Configuration-Driven Development:

    • Define routes, assets, or bundle dependencies in composer.yml:
      # composer.yml
      extra:
          core-bundle:
              routes:
                  prefix: /api
                  files: [routes/web.yml]
              assets:
                  paths:
                      - public/css
                      - public/js
      
    • Convert to JSON and reload dependencies:
      composer-ya.../composer-yaml.phar convert composer.yml composer.json
      composer update
      
  2. Asset Management:

    • Use the bundle’s asset pipeline (if supported) to compile/version assets via:
      php bin/console c33s:assets:compile
      
    • Configure in composer.yml:
      extra:
          core-bundle:
              assets:
                  enabled: true
                  manifest: public/assets/manifest.json
      
  3. Routing:

    • Define routes in composer.yml or separate YAML files (e.g., routes/web.yml):
      # routes/web.yml
      home:
          path: /
          controller: App\Controller\HomeController::index
      
    • Load routes via the bundle’s command:
      php bin/console c33s:routes:load
      
  4. Bundle Integration:

    • Extend functionality by creating custom bundles or overriding templates in Resources/views/ or Resources/config/.

Integration Tips

  • Laravel Compatibility:
    • If using Laravel, alias the bundle’s commands in app/Console/Kernel.php:
      protected $commands = [
          \C33s\CoreBundle\Command\InitCommand::class,
          // ... other commands
      ];
      
  • Environment-Specific Configs:
    • Use composer.yml environment variables (e.g., dev, prod) to switch settings:
      extra:
          core-bundle:
              debug: "%kernel.debug%"
      
    • Convert and run:
      composer-ya.../composer-yaml.phar convert --env=prod composer.yml composer.json
      

Gotchas and Tips

Pitfalls

  1. YAML-to-JSON Conversion:

    • Forgetting to run composer-ya.../composer-yaml.phar convert after editing composer.yml will cause composer install to fail with invalid JSON errors.
    • Fix: Add a pre-commit hook or alias:
      alias c33s-update='composer-ya.../composer-yaml.phar convert composer.yml composer.json && composer update'
      
  2. Missing Dependencies:

    • The bundle assumes composer-yaml.phar is installed globally. If missing, install it:
      wget https://github.com/igorw/composer-yaml/releases/latest/download/composer-yaml.phar
      chmod +x composer-yaml.phar
      sudo mv composer-yaml.phar /usr/local/bin/composer-yaml
      
  3. Route/Asset Overwrites:

    • Manually editing config/core_bundle.yml after running c33s:routes:load may cause conflicts. Use composer.yml as the single source of truth.
  4. Laravel-Specific Quirks:

    • The bundle may not fully integrate with Laravel’s service provider/container. Verify compatibility by checking if commands/register bundles work as expected.

Debugging

  • Command Errors:

    • Run commands with -v for verbose output:
      php bin/console c33s:core:init -v
      
    • Check var/log/core_bundle.log (if configured) for errors.
  • Configuration Validation:

    • Use php bin/console debug:config core_bundle to inspect loaded settings.

Extension Points

  1. Custom Commands:

    • Extend the bundle by creating new commands in src/Command/ and register them in the bundle’s Extension.php.
  2. Template Overrides:

    • Override default templates by placing files in Resources/views/ or Resources/config/ in your project.
  3. Event Listeners:

    • Listen to bundle events (e.g., core.bundle.init) via Laravel’s event system:
      // In a service provider
      $this->app->booted(function () {
          \Event::listen('core.bundle.init', function () {
              // Custom logic
          });
      });
      
  4. Asset Pipeline Hooks:

    • Extend asset compilation by implementing C33s\CoreBundle\Asset\AssetProcessorInterface and binding it in config/core_bundle.yml:
      extra:
          core-bundle:
              assets:
                  processors:
                      - App\Asset\CustomProcessor
      
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.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware