Weave 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

caseboxdev/core-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require caseboxdev/core-bundle
    

    Ensure Symfony CMF is installed (symfony/cmf and its dependencies).

  2. Enable Bundle Add to config/bundles.php:

    Casebox\CoreBundle\CaseboxCoreBundle::class => ['all' => true],
    
  3. First Use Case

    • Route a Casebox Controller Define a route in config/routes.yaml:
      casebox_core:
          resource: "@CaseboxCoreBundle/Resources/config/routing.yml"
          prefix: /casebox
      
    • Trigger a Casebox Service Inject Casebox\CoreBundle\Service\CaseboxService in a controller:
      use Casebox\CoreBundle\Service\CaseboxService;
      
      class MyController extends AbstractController {
          public function __construct(private CaseboxService $casebox) {}
      
          public function handleCase(Request $request) {
              $result = $this->casebox->processCase($request->get('case_data'));
              return new JsonResponse($result);
          }
      }
      
  4. Documentation Refer to Casebox.org for CMF-specific setup (e.g., routing, configuration).


Implementation Patterns

Common Workflows

  1. Case Processing Pipeline

    • Use CaseboxService to orchestrate workflows:
      $this->casebox->validate($data)
                   ->enrich($metadata)
                   ->dispatch($event);
      
    • Extend via event listeners (e.g., CaseboxEvents::CASE_VALIDATED).
  2. Controller Integration

    • REST API Endpoint:
      #[Route('/api/cases', methods: ['POST'])]
      public function createCase(Request $request, CaseboxService $casebox) {
          return $casebox->createCase($request->toArray());
      }
      
    • Symfony CMF Page: Extend Casebox\CoreBundle\Controller\CaseController for custom logic.
  3. Service Layer Abstraction

    • Decouple business logic from controllers:
      // services.yaml
      App\Service\CaseHandler:
          arguments:
              $casebox: '@casebox.core.service'
      
  4. Exception Handling

    • Catch Casebox\CoreBundle\Exception\CaseboxException globally:
      // config/packages/exception_listener.yaml
      services:
          App\EventListener\CaseboxExceptionListener:
              tags:
                  - { name: kernel.event_listener, event: kernel.exception, method: onCaseboxException }
      

Integration Tips

  • CMF Routing: Leverage Symfony CMF’s RouteObject for dynamic casebox routes.
  • Twig Integration: Pass case data to templates via controller:
    return $this->render('casebox/template.html.twig', ['case' => $caseData]);
    
  • Validation: Use Symfony’s Validator with Casebox\CoreBundle\Validator\Constraints\Casebox.

Gotchas and Tips

Pitfalls

  1. Deprecation Warnings

    • The bundle is archived and targets Symfony 3.x. Avoid in new projects unless maintaining legacy systems.
    • Check for breaking changes if upgrading Symfony CMF (e.g., routing system shifts).
  2. License Conflicts

    • AGPL 3.0 may clash with proprietary code. Audit dependencies if using in closed-source projects.
  3. Undocumented Dependencies

    • Assumes Symfony CMF is fully configured (e.g., cmf_routing bundle). Missing setup leads to:
      No route found for "GET /casebox"
      
    • Fix: Verify cmf_routing is enabled and routes are properly loaded.
  4. Service Autowiring

    • Older Symfony versions may require manual service registration:
      # config/services.yaml
      Casebox\CoreBundle\Service\CaseboxService: ~
      

Debugging

  • Enable Debug Mode Add to config/packages/dev/debug.yaml:
    services:
        Casebox\CoreBundle\Debug\CaseboxDebugListener:
            tags: ['kernel.event_listener', { event: kernel.request, method: onRequest }]
    
  • Log Casebox Events Configure Monolog to capture CaseboxEvents:
    // config/packages/monolog.yaml
    handlers:
        casebox:
            type: stream
            path: "%kernel.logs_dir%/casebox.log"
            level: debug
            channels: ["casebox"]
    

Extension Points

  1. Custom Controllers Extend Casebox\CoreBundle\Controller\AbstractCaseController:

    class CustomCaseController extends AbstractCaseController {
        protected function configureRoutes(RouteCollection $collection) {
            $collection->add('custom_case', $this->createRoute('/custom'));
        }
    }
    
  2. Event Subscribers Listen to CaseboxEvents::CASE_CREATED:

    class CaseCreatedSubscriber implements EventSubscriberInterface {
        public static function getSubscribedEvents() {
            return [CaseboxEvents::CASE_CREATED => 'onCaseCreated'];
        }
    
        public function onCaseCreated(CaseCreatedEvent $event) {
            // Custom logic (e.g., send notification)
        }
    }
    
  3. Override Services Replace CaseboxService with a decorator:

    # config/services.yaml
    App\Service\DecoratedCaseboxService:
        decorates: 'casebox.core.service'
        arguments: ['@App\Service\DecoratedCaseboxService.inner']
    

Configuration Quirks

  • Routing Prefix The bundle expects /casebox as default. Override in routing.yml:
    casebox_core:
        prefix: /my-custom-prefix
    
  • Service Aliases The service is registered as casebox.core.service. Use this alias in DI containers.
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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings