dbp/relay-dispatch-bundle
Symfony bundle providing the Relay Dispatch API backend. Works with the Dispatch Frontend app, offering endpoints and services for dispatch workflows. Includes docs, changelog, and CI-tested code for integrating dispatch features into your Relay setup.
Installation:
composer require dbp/relay-dispatch-bundle
php bin/console doctrine:migrations:migrate --em=dbp_relay_dispatch_bundle
Configure (config/packages/dbp_relay_dispatch.yaml):
dbp_relay_dispatch:
database_url: "mysql://user:pass@localhost/db_name"
service_url: "https://provider-soap-endpoint"
sender_profile: "YOUR_PROFILE_ID"
sender_profile_version: "1.0"
cert: "%env(DISPATCH_CERT)%" # Base64-encoded PEM
cert_password: "%env(DISPATCH_CERT_PASSWORD)%"
First Use Case: Create a delivery request via CLI (for testing):
php bin/console dbp:relay:dispatch:test-seed create \
--request-person-id=1234567890 \
--recipient-person-id=9876543210 \
--submit --direct --output-request-xml
Request Creation & Submission:
DispatchRequest entity to model deliveries.DispatchDocument (stored in DB or blob storage).POST /dispatch/requests) or CLI (--submit flag).Recipient Management:
$request->addRecipient($recipientEntity);
php bin/console dbp:relay:dispatch:status-request ADID_...
Authorization Integration:
ROLE_USER and group-specific roles (e.g., ROLE_GROUP_WRITER) in Symfony’s security voter.public function supports($attribute, $subject)
{
return $attribute instanceof Role && in_array($attribute->getAttribute(), ['ROLE_GROUP_WRITER']);
}
SOAP Communication:
DuaZSpecClient for custom logic if needed.blob storage for large documents (configure blob_base_url, blob_bucket_id, etc.).SOAP Certificate Issues:
cert is base64-decoded in config (see README tips).php bin/console dbp:relay:dispatch:status-request ADID_... --output-response-xml
Authorization Misconfigurations:
ROLE_GROUP_WRITER implies all read roles. Verify group assignments in GROUPS attribute.$this->denyAccessUnlessGranted('ROLE_GROUP_WRITER', $group);
File Storage Quirks:
database storage limits file sizes. Use blob for >1MB files.php bin/console cache:clear
relay:errorId in responses (e.g., dispatch:request-file-missing-request-identifier).monolog to log SOAP requests/responses.Custom SOAP Clients:
Extend DuaZSpecClient to support non-DuaZSpec providers:
class CustomClient extends DuaZSpecClient {
public function __construct($serviceUrl, $cert, $certPassword) {
// Override SOAP options
}
}
Dynamic Group Roles:
Use Symfony’s ExpressionLanguage for dynamic role checks:
ROLE_GROUP_WRITER: 'user.hasRole("ROLE_ADMIN") || user.hasRole("ROLE_" ~ group.getIdentifier())'
Webhook Handling:
Listen for DeliveryStatusChange events to trigger notifications:
// config/services.yaml
App\EventListener\StatusChangeListener:
tags:
- { name: kernel.event_listener, event: dbp_relay_dispatch.delivery_status_change }
How can I help you explore Laravel packages today?