bahdan / lead-capture-bundle
Lead and contact request capture bundle with dual Doctrine and JSONL storage
Package info
github.com/bahdanhal/lead-capture-bundle
Type:symfony-bundle
pkg:composer/bahdan/lead-capture-bundle
Requires
- php: >=8.3
- symfony/config: ^7.0 || ^8.0
- symfony/dependency-injection: ^7.0 || ^8.0
- symfony/event-dispatcher-contracts: ^3.0
- symfony/http-kernel: ^7.0 || ^8.0
Requires (Dev)
- doctrine/dbal: ^3.8 || ^4.0
- doctrine/orm: ^3.0
- phpunit/phpunit: ^11.0 || ^12.0
Suggests
- doctrine/dbal: Required when using Doctrine storage.
- doctrine/orm: Required when using Doctrine storage.
README
Lead ingestion and contact request processing bundle for Symfony applications with dual Doctrine ORM and JSONL storage backends.
Features
- Domain Model: Strictly validated
Leaddomain value object (email/phone normalization, content size guarding, HMAC-hashed IP tracking). - Dual Persistence: Production Doctrine ORM entity mapping and fallback append-only JSONL storage.
- Application Services:
CaptureLeadorchestration use-case. - Integration Hook: Dispatches
LeadCapturedafter persistence so applications can notify email, Slack, Telegram, a CRM, or a webhook without coupling those transports to the bundle. - Portable Doctrine Storage: Attribute mappings are registered automatically and date values use DBAL types across PostgreSQL, MySQL/MariaDB, and SQLite.
- Bounded JSONL Reads: Limited admin queries read newest records from disk without loading an entire monthly partition.
Installation
composer require bahdan/lead-capture-bundle
Doctrine is optional. Install it only when selecting the Doctrine storage backend:
composer require doctrine/orm doctrine/dbal
The JSONL backend does not register or resolve Doctrine services.
When Doctrine storage is selected, the bundle registers its entity mapping automatically. Your application still owns schema migrations; generate and review a migration after enabling the bundle.
Notifications and webhooks
Listen for Bahdan\LeadCaptureBundle\Event\LeadCaptured with a regular Symfony event listener. The event contains the validated Lead; the listener can hand it to Messenger for asynchronous email, chat, CRM, or webhook delivery.
use Bahdan\LeadCaptureBundle\Event\LeadCaptured; use Symfony\Component\EventDispatcher\Attribute\AsEventListener; #[AsEventListener] final class NotifyAboutLead { public function __invoke(LeadCaptured $event): void { // Dispatch an application-specific notification or Messenger message. } }
Configuration
Register the bundle in config/bundles.php:
return [ // ... Bahdan\LeadCaptureBundle\LeadCaptureBundle::class => ['all' => true], ];
License
MIT