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

Msf Bundle Laravel Package

blixit/msf-bundle

blixit/msf-bundle is a Laravel/PHP bundle centered on MSF integration, providing packaged configuration and reusable components to help wire the service into your app. Intended as a lightweight starting point rather than a full-featured framework.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require blixit/msf-bundle
    

    Enable the bundle in app/AppKernel.php:

    new Blixit\MSFBundle\MSFBundle(),
    
  2. Basic Configuration Add to app/config/config.yml:

    blixit_msf:
        steps:
            - { id: 'step1', label: 'Step 1' }
            - { id: 'step2', label: 'Step 2' }
    
  3. First Use Case: Simple Multi-Step Form Create a controller:

    use Blixit\MSFBundle\Controller\MultiStepFormController;
    
    class MyFormController extends MultiStepFormController
    {
        public function configureSteps()
        {
            return [
                'step1' => ['template' => 'MyBundle:Form:step1.html.twig'],
                'step2' => ['template' => 'MyBundle:Form:step2.html.twig'],
            ];
        }
    }
    

    Define routes in routing.yml:

    my_form:
        resource: "@MyBundle/Controller/MyFormController.php"
        type:     annotation
    

Implementation Patterns

Workflow: Step-Based Form Handling

  1. Step Definition Use YAML/annotation/config to define steps:

    blixit_msf:
        steps:
            - { id: 'personal', label: 'Personal Info', form: 'AppBundle\Form\PersonalType' }
            - { id: 'payment', label: 'Payment', form: 'AppBundle\Form\PaymentType' }
    
  2. Controller Integration Extend MultiStepFormController and override:

    public function getFormClass($stepId)
    {
        return 'AppBundle\Form\\' . ucfirst($stepId) . 'Type';
    }
    
    public function getFormOptions($stepId, array $options)
    {
        return array_merge($options, ['step_id' => $stepId]);
    }
    
  3. Template Structure Use {{ form_start(form) }} in each step template (step1.html.twig):

    <div class="step {{ step.id }}">
        {{ form_widget(form) }}
        {% if not step.isLast %}
            <button type="submit" class="next">Next</button>
        {% else %}
            <button type="submit" class="submit">Submit</button>
        {% endif %}
    </div>
    
  4. Data Persistence Store intermediate data in session:

    $this->get('session')->set('msf_data', $form->getData());
    

Integration Tips

  • Validation: Use Symfony’s validation constraints per step.
  • Transitions: Customize step transitions via onStepTransition().
  • Events: Listen to msf.step.enter/msf.step.leave for side effects.

Gotchas and Tips

Pitfalls

  1. Session Management

    • Forgetting to persist data between steps causes lost input.
    • Fix: Always call $this->get('session')->set('msf_data', ...) after each step.
  2. Step ID Mismatches

    • Template paths must match configured step IDs exactly.
    • Fix: Validate configureSteps() returns match blixit_msf.steps config.
  3. Form Submission Quirks

    • Default submit buttons may not trigger step transitions.
    • Fix: Use {{ form_rest(form) }} or custom buttons with data-msf-next attributes.

Debugging

  • Check Step Flow Dump $this->getStep() in controller to verify current step.
  • Validate Session Data Inspect $this->get('session')->get('msf_data') for corrupted payloads.

Extension Points

  1. Custom Step Logic Override onStepEnter()/onStepLeave() in controller:

    public function onStepEnter($stepId)
    {
        if ($stepId === 'payment') {
            $this->denyAccessUnlessGranted('ROLE_PREMIUM');
        }
    }
    
  2. Dynamic Steps Load steps from database:

    public function configureSteps()
    {
        $steps = $this->getDoctrine()->getRepository('AppBundle:Step')->findAll();
        return array_map(function($step) {
            return ['template' => $step->getTemplate()];
        }, $steps);
    }
    
  3. CSRF Protection Disable per-step if needed (not recommended):

    blixit_msf:
        disable_csrf: true
    
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.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui