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

Vb Bundle Laravel Package

aureka/vb-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Install the Bundle Add to composer.json:

    "require": {
        "aureka/vb-bundle": "dev-master"
    }
    

    Run composer update.

  2. Register the Bundle Add to AppKernel.php:

    new Aureka\VBBundle\AurekaVBBundle(),
    
  3. Configure config.yml Minimal required config:

    aureka_vb:
        license: 'YOUR_LICENSE_FROM_vbulletin/functions.php'
        database:
            driver: 'pdo_mysql'
            host: 'localhost'
            name: 'vb_database'
            user: 'vb_user'
            password: 'vb_password'
    
  4. First Use Case: SSO Login After configuring, users logging into Symfony will automatically log into vBulletin. Test by:

    • Logging in via Symfony’s security layer.
    • Verify the vBulletin session is active by checking cookies (bb_* prefix) or inspecting the vBulletin database for the user’s session.

Implementation Patterns

Workflow: Single Sign-On (SSO)

  1. User Authentication Flow

    • Symfony’s security.yml handles authentication. The bundle hooks into the onAuthenticationSuccess event to create/update a vBulletin session.
    • Example event subscriber (optional, if custom logic is needed):
      use Aureka\VBBundle\Event\VBAuthenticationEvent;
      
      public function onVBAuthentication(VBAuthenticationEvent $event)
      {
          $user = $event->getUser();
          // Custom logic (e.g., map Symfony roles to vBulletin usergroups)
      }
      
      Register in services.yml:
      services:
          app.vb_auth_listener:
              class: AppBundle\EventListener\VBAuthListener
              tags:
                  - { name: kernel.event_listener, event: aureka_vb.authentication, method: onVBAuthentication }
      
  2. Database Synchronization

    • The bundle assumes vBulletin’s database schema. For custom fields or tables, extend the bundle by overriding its services (e.g., aureka_vb.vb_user_provider).
    • Example: Add a custom user field sync:
      // Override the VBUserProvider service
      app.vb_user_provider:
          class: AppBundle\Security\CustomVBUserProvider
          parent: aureka_vb.vb_user_provider
          arguments: ['@service_container']
      
  3. Logout Handling

    • Configure security.yml as shown in the README. The aureka_vb.logout_handler ensures vBulletin sessions are terminated on Symfony logout.

Integration Tips

  • Role Mapping: Use Symfony’s voter system to map roles to vBulletin usergroups. Example:
    public function supportsAttribute($attribute)
    {
        return $attribute === 'ROLE_VB_MODERATOR';
    }
    
    public function supportsClass($class)
    {
        return $class === 'AppBundle\Entity\User';
    }
    
    public function vote(TokenInterface $token, $attribute, array $object = null)
    {
        $vbUser = $token->getUser()->getVbUser();
        return $vbUser->getUsergroupid() === 6 ? AccessControlInterface::ACCESS_GRANTED : AccessControlInterface::ACCESS_ABSTAIN;
    }
    
  • Session Validation: Validate vBulletin sessions periodically (e.g., via a cron job or Symfony command) to clean up stale sessions:
    use Aureka\VBBundle\Manager\VBSessionManager;
    
    public function execute(InputInterface $input, OutputInterface $output)
    {
        $sessionManager = $this->get('aureka_vb.vb_session_manager');
        $sessionManager->cleanupStaleSessions();
    }
    

Gotchas and Tips

Pitfalls

  1. License Key Validation

    • The bundle checks the vBulletin license key on every request. If invalid, SSO fails silently. Debug tip: Enable Symfony’s profiler to catch Aureka\VBBundle\Exception\InvalidLicenseException.
    • Fix: Verify the license key matches exactly what’s in vbulletin/functions.php (case-sensitive).
  2. Database Schema Mismatch

    • The bundle assumes default vBulletin tables (e.g., vb3_user). If your installation uses a custom prefix (e.g., custom_vb_), update the table_prefix in config and override the bundle’s VBConnection service:
      aureka_vb.vb_connection:
          class: AppBundle\VB\CustomVBConnection
          arguments: ['@doctrine.dbal.default_connection']
      
  3. Cookie Conflicts

    • The bundle uses cookies prefixed with bb_. If your Symfony app or other bundles use similar prefixes, sessions may interfere. Tip: Change cookie_prefix in config or ensure no overlaps.
  4. IP Checking

    • If ip_check: 1 is set, the bundle validates the user’s IP against vBulletin’s session. Gotcha: This can break SSO for users with dynamic IPs (e.g., mobile devices). Tip: Disable for testing or use a more lenient check.
  5. Session Expiry

    • vBulletin sessions expire after inactivity (configurable in vBulletin’s cookie settings). Symfony’s session may remain active longer, causing SSO to appear broken. Tip: Sync session expiry logic or use a shorter Symfony session lifetime.

Debugging

  • Enable Debug Mode: Add this to config.yml to log errors:
    aureka_vb:
        debug: true
    
  • Check Events: Listen for bundle events to debug SSO flow:
    services:
        app.vb_debug_listener:
            class: AppBundle\EventListener\VBDebugListener
            tags:
                - { name: kernel.event_listener, event: aureka_vb.authentication, method: onDebugAuth }
                - { name: kernel.event_listener, event: aureka_vb.logout, method: onDebugLogout }
    

Extension Points

  1. Custom User Provider Override the default VBUserProvider to fetch users from a custom source (e.g., API):

    class CustomVBUserProvider extends VBUserProvider
    {
        public function loadUserByUsername($username)
        {
            // Custom logic (e.g., call vBulletin API)
            return $this->createVBUser($data);
        }
    }
    

    Register as a service:

    aureka_vb.vb_user_provider:
        class: AppBundle\Security\CustomVBUserProvider
        arguments: ['@api_client']
    
  2. Post-Authentication Actions Extend the VBAuthenticationEvent to trigger actions after SSO:

    public function onVBAuthentication(VBAuthenticationEvent $event)
    {
        $vbUser = $event->getVbUser();
        // Example: Log activity or update user metadata
        $this->activityLogger->log($vbUser->getUsername(), 'SSO Login');
    }
    
  3. Logout Customization Override the logout handler to add custom logic (e.g., log out from an API):

    class CustomVBLogoutHandler implements LogoutHandlerInterface
    {
        public function logout(Request $request, Response $response)
        {
            // Call parent logout
            $parentHandler = new VBLogoutHandler();
            $response = $parentHandler->logout($request, $response);
    
            // Custom logic (e.g., API call)
            $this->apiClient->logoutUser($request->getSession()->get('vb_user_id'));
    
            return $response;
        }
    }
    

    Register in security.yml:

    logout:
        handlers: [app.vb_custom_logout_handler]
    
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.
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views
spatie/ignition-contracts
earls/stork-command-queue-bundle