fmasites / omeda
Omeda API client and utilities for Laravel
v0.5.1
2026-08-13 21:49 UTC
Requires
- php: ^8.3
- illuminate/cache: ^11.0|^12.0
- illuminate/http: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^10.0
- phpunit/phpunit: ^11.0
README
A Laravel package for interacting with the Omeda API.
Requirements
- PHP 8.3+
- Laravel 11 or 12
Installation
composer require fmasites/omeda
Configuration
Add the following to your .env file:
OMEDA_APP_ID= OMEDA_BASE_API_URL= OMEDA_BRAND= OMEDA_CLIENT= OMEDA_CLIENT_BASE_API_URL= OMEDA_INPUT_ID=
| Variable | Description |
|---|---|
OMEDA_APP_ID |
Your Omeda application ID |
OMEDA_BASE_API_URL |
Base URL for the Omeda brand API |
OMEDA_BRAND |
Your Omeda brand abbreviation |
OMEDA_CLIENT |
Your Omeda client abbreviation |
OMEDA_CLIENT_BASE_API_URL |
Base URL for client-level API endpoints |
OMEDA_INPUT_ID |
Input ID used for POST requests |
Usage
OmedaApi
use FMASites\Omeda\OmedaApi; $api = new OmedaApi();
You can also inject custom base URLs directly, which is useful in tests:
$api = new OmedaApi(baseApiUrl: 'https://...', clientBaseApiUrl: 'https://...');
Available methods
// Brand $api->brandComprehensiveLookup(); // Cached for 8 hours // Customer $api->customerComprehensiveLookup($id); $api->customerLookupByEmail($email); $api->customerLookupByEmailCandidates($email); // 300 (multiple matches) returns the Customers list instead of false // Orders & Transactions $api->storeCustomerAndOrder($data); $api->transactionLookup($transactionId); $api->runProcessor($transactionIds); // Utility API // Postal $api->postalInfoLookup($zipCode); // Utility API // Behaviors $api->assignBehavior($customerId, $behaviors); // Email $api->emailOptinQueue($email, $deploymentTypeId, $options); // Products & Deployments $api->productLookupByBrand(); // All defined products for the brand, including past Issues per product $api->emailDeploymentSearch($criteria); // Search past Omail deployments, e.g. ['Type' => $deploymentTypeId, 'DeploymentDateStart' => ..., 'DeploymentDateEnd' => ..., 'Statuses' => ['SENT']] $api->emailDeploymentLookup($trackId); // Deployment detail, including per-split HtmlContentUrl/TextContentUrl $api->fetchDeploymentContent($url); // Fetches a HtmlContentUrl/TextContentUrl - these need the appid header too, so they can't be linked to directly
GET methods return array|false — false indicates a non-successful response (404, 300, etc.). POST methods return an Illuminate\Http\Client\Response instance.
Getting HTML links for past issues of a deployment product
- Call
productLookupByBrand()and find the product of interest (e.g. filter byProductTypeorDeploymentTypeId). - Call
emailDeploymentSearch()with that product'sDeploymentTypeIdasType, a date range, andStatuses => ['SENT']to get the past deployments'TrackIds. - Call
emailDeploymentLookup($trackId)for each and readHtmlContentUrloff each entry inSplits. HtmlContentUrl/TextContentUrlare themselves Omeda API URLs and 400 with "No applicationId was submitted" if fetched directly (e.g. linked to from a browser) - fetch them server-side withfetchDeploymentContent($url)instead.
DataAdapter
Utilities for transforming brand comprehensive lookup data:
use FMASites\Omeda\DataAdapter; // Filter demographics down to specific type IDs DataAdapter::filterByDemographicTypes($brandData, [1, 2, 3]); // Simplify the full brand lookup response to a smaller structure DataAdapter::simplifyBrandComprehensiveLookupData($brandData); // Remove specific demographic value options by ID DataAdapter::removeDemographicValueOptionsById($brandData, [10, 11]); // Simplify a products array DataAdapter::simplifyProductData($products);
Enums
The package includes enums for common Omeda constants:
| Enum | Description |
|---|---|
AddressContactType |
Address contact type codes |
EmailContactType |
Email contact type codes |
PhoneContactType |
Phone contact type codes |
MarketingClassCode |
Marketing classification codes |
ProductType |
Product type codes |
SubscriptionClassCode |
Subscription classification codes |
LocationCodes |
Country, US state, Canadian province, and Mexican state codes |
Testing
composer install ./vendor/bin/phpunit