Install the Bundle
Add to composer.json:
"require": {
"aureka/vb-bundle": "dev-master"
}
Run composer update.
Register the Bundle
Add to AppKernel.php:
new Aureka\VBBundle\AurekaVBBundle(),
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'
First Use Case: SSO Login After configuring, users logging into Symfony will automatically log into vBulletin. Test by:
bb_* prefix) or inspecting the vBulletin database for the user’s session.User Authentication Flow
security.yml handles authentication. The bundle hooks into the onAuthenticationSuccess event to create/update a vBulletin session.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 }
Database Synchronization
aureka_vb.vb_user_provider).// Override the VBUserProvider service
app.vb_user_provider:
class: AppBundle\Security\CustomVBUserProvider
parent: aureka_vb.vb_user_provider
arguments: ['@service_container']
Logout Handling
security.yml as shown in the README. The aureka_vb.logout_handler ensures vBulletin sessions are terminated on Symfony logout.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;
}
use Aureka\VBBundle\Manager\VBSessionManager;
public function execute(InputInterface $input, OutputInterface $output)
{
$sessionManager = $this->get('aureka_vb.vb_session_manager');
$sessionManager->cleanupStaleSessions();
}
License Key Validation
Aureka\VBBundle\Exception\InvalidLicenseException.vbulletin/functions.php (case-sensitive).Database Schema Mismatch
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']
Cookie Conflicts
bb_. If your Symfony app or other bundles use similar prefixes, sessions may interfere. Tip: Change cookie_prefix in config or ensure no overlaps.IP Checking
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.Session Expiry
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.config.yml to log errors:
aureka_vb:
debug: true
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 }
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']
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');
}
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]
How can I help you explore Laravel packages today?