Download the PHP package obsidiane/notifuse-symfony-bundle without Composer
On this page you can find all versions of the php package obsidiane/notifuse-symfony-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download obsidiane/notifuse-symfony-bundle
More information about obsidiane/notifuse-symfony-bundle
Files in obsidiane/notifuse-symfony-bundle
Package notifuse-symfony-bundle
Short Description Symfony bundle that integrates the Notifuse API and notification center
License MIT
Informations about the package notifuse-symfony-bundle
Notifuse Symfony Bundle
Symfony bundle to integrate the Notifuse API in your application. It focuses on:
- A small, explicit HTTP client wrapper for the Notifuse API (
Service\ApiClient). - A thin configuration layer (DI extension + YAML) to keep endpoints and options fully configurable. The Notification Center UI embed is handled directly by Notifuse’s front-end script and is not part of this bundle.
The bundle does not hide Symfony’s HttpClient. Instead, it applies the base URL, headers and common options for you, and gives you escape hatches to pass per‑request options when needed.
How It Works
- Configuration is declared under the
notifusekey and loaded byDependencyInjection\NotifuseExtension. - Services are registered in
Resources/config/services.yamland autowired into your code. Service\ApiClientprefixes requests withapi_base_url, injects authentication headers (Authorization: Bearer …,X-Workspace-ID) and merges configured HTTP client options. The UI widget is not generated by this bundle; integrate the Notification Center via Notifuse's front-end script.
Installation
Install from your application root:
If you are not using Symfony Flex auto‑registration, enable the bundle in the kernel:
Configuration
Recommended configuration workflow:
Option reference:
api_base_url: Base URL for the Notifuse API (e.g.https://api.notifuse.com).workspace_id: Your workspace identifier; sent as header and embed parameter.workspace_api_key: Bearer token used for API calls; keep it in env/secrets.http_client_options: Subset of Symfony HttpClient options applied to every call (timeout,max_redirects,verify_peer,headers). You can still override them per request. The Notification Center script and container are not managed by this bundle.
API Usage
Inject Service\ApiClient and call request($method, $endpoint, $options = []). The $endpoint is appended to api_base_url.
Error handling: network/HTTP client errors are wrapped in Service\Exception\NotifuseClientException with the original exception as previous. Catch it at your boundary if you want to map to domain errors.
Endpoint Helpers
The ApiClient exposes convenience methods for all Notifuse endpoints:
sendTransactional(array $notification, ?string $workspaceId = null, array $options = []): POST/api/transactional.sendupsertContact(array $contact, ?string $workspaceId = null, array $options = []): POST/api/contacts.upsertgetContactByEmail(string $email, ?string $workspaceId = null, array $options = []): GET/api/contacts.getByEmailgetContactByExternalId(string $externalId, ?string $workspaceId = null, array $options = []): GET/api/contacts.getByExternalIDimportContacts(array $contacts, array $subscribeToLists = [], ?string $workspaceId = null, array $options = []): POST/api/contacts.importdeleteContact(string $email, ?string $workspaceId = null, array $options = []): POST/api/contacts.deleteupdateContactListStatus(string $email, string $listId, string $status, ?string $workspaceId = null, array $options = []): POST/api/contactLists.updateStatuspublicSubscribeToLists(array $contact, array $listIds, ?string $workspaceId = null, array $options = []): POST/subscribe(no auth header sent)
Examples:
Embedding the Notification Center
The UI embed is not handled by this bundle. Include Notifuse’s front-end script directly where you need the Notification Center.
HTTP Client Options
Global defaults are provided via notifuse.http_client_options. You can still override on each call via $options in ApiClient::request().
Common examples:
Compatibility
- PHP:
^8.0 - Symfony:
^6.4or^7.0
Services Summary
| Service ID | Class | Description |
|---|---|---|
Obsidiane\Notifuse\ApiClient |
Service\ApiClient |
Authenticated requests to the Notifuse API. |
CI, Releases and Composer Registry
The pipeline validates the package on all branches. Releases are handled by GitHub Actions when pushing to master or when a tag is pushed.
See .github/workflows/ci.yml and .github/workflows/release.yml for the exact flow.
Testing
This bundle does not ship with its own test-suite. When writing tests in your application, you can mock HttpClientInterface and assert:
- URL resolution/headers in
ApiClient::request().