Weave 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

Notification Bundle Laravel Package

reliefapps/notification-bundle

Symfony bundle that adds a flexible notification system to your app: create, persist, and deliver notifications to users through configurable channels. Includes Doctrine integration, Twig templates, and simple setup so you can wire notifications into existing projects quickly.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Check your Symfony version first. This bundle targets Symfony 3 (symfony/symfony: ^3.0-era conventions: AppKernel registration, manual app/config/config.yml import). There is no Flex recipe, no config/bundles.php, and autowiring is not assumed. If you're on Symfony 4+, budget time for a fork or a Symfony 3 service container compatibility layer before doing anything else.
  • Install manually. Because the package is archived and has no recipe:
    composer require reliefapps/notification-bundle:@dev
    
    If Packagist resolution fails, add it as a VCS repository in composer.json and pin a specific commit.
  • Register in AppKernel. Add new Relief\NotificationsBundle\AppNotificationsBundle() to registerBundles(). There is likely no routing to import if the bundle is purely a service layer.
  • Look at DependencyInjection/Configuration.php before anything else. With 3 stars, no dependents, and no maintained documentation, the config tree is the documentation. Open it and note the exact keys for the APNs certificate path/passphrase and the GCM/FCM API key, plus any host/sandbox flags.
  • Configure credentials per environment, not in the bundle defaults:
    # app/config/config.yml
    app_notifications:
        apns:
            certificate: "%kernel.root_dir%/config/certs/apns_prod.pem"
            passphrase:  "%apns_passphrase%"
            sandbox:     false
        gcm:
            api_key: "%gcm_api_key%"
    
    Keep the .pem and the API key out of version control; load the passphrase from parameters.yml/env.
  • First use case: prove the pipe with a console command. Build a one-off Command that resolves the bundle's notification service and pushes a single test payload to one hardcoded device token per platform. Don't wire it into domain logic until both APNs and GCM return success. Verify the service ID with bin/console debug:container | grep -i notif since the public service name isn't documented.

Implementation Patterns

  • Wrap the bundle, don't sprinkle it. Because the package is archived, you want a single seam. Create your own AppNotificationDispatcher that injects the bundle's sender(s) and exposes domain-level methods (notifyUser(User $u, string $title, array $data)). When you eventually need to swap in a maintained library, you change one class instead of every caller.
  • Resolve senders per platform, fan out in your own code. The bundle gives you iOS and Android senders; you own the "which tokens belong to which platform" decision. Store device_token + platform in your own table and loop, calling the correct sender for each row. Do not expect the bundle to know your user model.
  • Send from a queue, not from the request cycle. APNs and GCM calls are synchronous HTTP with variable latency, and one bad token can throw mid-loop. Dispatch a job (or a kernel-terminate listener for low volume) that performs the send, so a slow push never blocks a user's HTTP response and a failed push doesn't roll back business logic.
  • Batch loop with per-token error capture, not a single all-or-nothing call:
    foreach ($tokens as $token) {
        try {
            $sender->send($token, $payload);
        } catch (\Exception $e) {
            $this->logger->warning('push failed', ['token' => $token, 'err' => $e->getMessage()]);
            // mark token stale for later pruning
        }
    }
    
    A single expired token should never abort the rest of the batch.
  • Config-driven platform toggles. Use sandbox: true in dev and test, false in prod. The most common day-to-day bug is a developer testing against production APNs with a sandbox token (or vice versa) and getting silent "success but nothing arrives."
  • Alias the sender services in test env. In services_test.yml, decorate or alias the bundle's sender with a fake that records payloads, so functional tests can assert "a notification was queued for user X" without hitting Apple or Google.
  • Keep payload construction in your layer. Build the aps/data array yourself and hand it to the sender. This keeps you portable and lets you assert on payload shape in unit tests.
  • Integration tip: mirror it to a local "outbox". Persist every dispatched notification (user, title, body, platform, token, timestamp, response) in your own table. With an unmaintained bundle and no observability built in, your outbox is your only debugging surface.

Gotchas and Tips

  • Archived = frozen. 3 stars, 0 dependents, no maintainer. Treat it as vendored code: fork it into your monorepo, or at minimum lock the exact commit and be prepared to patch vendor/ via a Composer patch plugin. Do not build a long-term roadmap on it.
  • Symfony 3 is EOL. You're inheriting an EOL framework plus an archived bundle. If the project is new, this is a strong signal to evaluate alternatives (symfony/notifier covers push transports and is maintained) rather than adopt this.
  • GCM is dead. The bundle speaks the legacy GCM endpoint, which Google shut down in 2019 in favor of FCM v1 (HTTP v1 with OAuth2 bearer tokens). Expect to patch the transport or route Android through your own FCM call. Verify the endpoint URL in the sender class before trusting it in production.
  • APNs auth has moved on. If the bundle uses certificate-based auth (.pem + passphrase), it will still work for legacy certs but not with the modern .p8 token-based flow (JWT). Certificate expiry is a classic 3 a.m. page — put an expiry reminder on the cert and monitor APNs response codes, not just exceptions.
  • Silent failures are the norm. APNs returns 200 even for some rejected payloads; GCM returns 200 with an error body. Log the raw response body and HTTP status for every send, not just thrown exceptions. If the bundle swallows responses, wrap the call and inspect what you can.
  • Payload size limits bite. APNs caps the payload at 4 KB (2 KB historically for older OS versions); GCM/FCM at 4 KB too. Large data blobs (image URLs are fine, base64 images are not) get dropped silently. Validate size in your dispatcher before calling.
  • Certificate/passphrase handling is a config quirk. Paths are resolved relative to the kernel root in some Symfony bundles and absolutely in others — test with an absolute path first, then narrow. A wrong passphrase often surfaces as a generic TLS handshake error, not a clear "bad password" message.
  • No autowiring on Symfony 3. If you're used to type-hint injection, you must define services explicitly or enable autowiring per-service. Grab the service ID from debug:container and reference it by ID in your services.yml.
  • Extension points are limited but real. You can override the bundle's sender service by defining a service with the same ID in your app config (later definition wins), and you can decorate it. That is your escape hatch for patching the GCM endpoint or adding logging without editing vendor/.
  • Debug the transport directly when it misbehaves. Reproduce with curl against api.push.apple.com or the FCM endpoint using the same credentials. If curl succeeds and the bundle fails, the problem is config resolution or the payload; if both fail, it's credentials or network — that split saves hours.
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.
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource