plotkabytes/redlink-api-php-client
Plotkabytes Redlink API PHP Client is a lightweight wrapper for the Redlink API, giving PHP and Laravel developers straightforward request handling and simple integration. It keeps dependencies minimal and the code easy to read, so you can query Redlink endpoints from any PHP project without extra b...
This package wraps an external, Application-Key-authenticated delivery API behind a familiar Laravel surface (config + a notifiable/channel or facade call). 1.0.1 is a patch release: no breaking changes, but two things are worth knowing on day one — the Application-Key is now validated for format before a request is made, and attachments can finally be passed through as a supported parameter.
composer require <vendor>/<package>:^1.0
php artisan vendor:publish --tag=<package>-config
.env (never in the config file), and mirror it in config/<package>.php:
<PACKAGE>_APPLICATION_KEY=your-key-here
Where to look first:
config/<package>.php — key name, base URL/sandbox toggle, default sender, timeout.README "Attachments" section — 1.0.1 changed what is accepted here, so read it rather than relying on pre-1.0.1 blog posts.Keep the key in config, not in code. Resolve it via config('<package>.application_key') so php artisan config:cache and per-environment .env files behave. If you rotate keys, rotate through the environment, not by editing PHP.
Attachments — prefer paths and streams over raw contents. The 1.0.1 fix exposes attachments as a first-class allowed param; the safe shape in day-to-day use is:
$message->attach($pathOnDisk, ['as' => 'invoice.pdf', 'mime' => 'application/pdf']);
When the file lives on a non-local disk, stream it (Storage::disk('s3')->readStream($path)) rather than get(), which loads the whole file into memory and is the usual cause of memory-limit failures on large exports.
Attach conditionally, not in loops. Build the attachment list from a small array or collection and pass it once. This keeps payloads predictable and makes it trivial to assert on them in tests.
Queue the send, not the file read. Implement ShouldQueue on the notification and read/attach inside the queued job so the file is resolved at send time. If you must attach before dispatch, ensure the attachment serializes cleanly (see Gotchas).
Testing. Fake the underlying HTTP client (Http::fake()) and assert on the outgoing multipart body: the Application-Key header, the recipient, and the presence of the attachment filename. Because 1.0.1 validates key format client-side, a malformed key in a test now fails loudly with a package exception instead of a 401 from the API — assert on the exception message so key misconfiguration is caught in CI.
Integration tip. If your app already sends mail via Laravel's Mail facade, keep transactional email there and use this package for the notifications it uniquely supports; mixing both for the same message type creates two sources of truth for templates and attachments.
Application-Key before dispatch. If your key was previously accepted (or silently failed with a provider 401), a trailing newline, surrounding quotes, or a copy-paste artifact from a secrets manager will now throw immediately. Trim in .env or read the value through trim() in a config accessor.UploadedFile instances from a request do not survive serialization. Convert to a path or a persisted file before dispatching, or read them inside the job.Notification guard clause where the failure is legible to you..env edits. After changing the key locally, run php artisan config:clear; a stale cached config is the most common "the key is definitely right" bug report.^1.0.1 since the attachment param and key validation are the behaviour you're now testing against.How can I help you explore Laravel packages today?