InvergeDocs
PHPAPI reference

Push

Push in the PHP SDK.

// access
$nexus->push()
SymbolKindSummary
PushclassPush notifications.
PushBuilderclassFluent builder for a transactional push.

Push

class
class Inverge\Nexus\Resource\Push

Push notifications. Server-side you mainly send transactional notifications to users or segments; campaigns, provider credentials, segments and templates are managed in the Nexus console. Delivered via FCM / APNs / Web Push.

Prefer the fluent builder for anything beyond a plain send: $nexus->push()->notification()->title('…')->setSegments(['vip'])->send();

View source

__construct

constructor
function __construct(Inverge\Nexus\NexusClient $client)

Parameters

Prop

Type

View source

notification()

method
function notification(): Inverge\Nexus\Push\PushBuilder

Start a fluent push notification. */

Returns Inverge\Nexus\Push\PushBuilder

View source

send()

method
function send(array $distinctIds, array $message): array

Send a transactional push to one or more users (by distinctId), delivered across each user's registered devices.

$message:

  • title (string, required)
  • body, imageUrl (string)
  • data (array<string,mixed>) — custom key/values delivered to the app
  • options (array) — rich per-platform options: buttons, androidLargeIcon, androidBigPicture, androidVisibility, iosBadge, iosRelevanceScore, iosInterruptionLevel, webIcon, … (see the console composer).

Parameters

Prop

Type

Returns array<mixed> — { sent, failed }

View source

sendRaw()

method
function sendRaw(array $payload): array

Send a fully-assembled payload (title + targeting: distinctIds / segmentIds / filter / all). Used by the builder; call it directly if you prefer.

Parameters

Prop

Type

Returns array<mixed> — { sent, failed, recipients }

View source

sendToUser()

method
function sendToUser(string $distinctId, array $message): array

Send the same notification to a single user.

Parameters

Prop

Type

Returns array<mixed>

View source

registerToken()

method
function registerToken(string $token, string $platform, array $options = []): array

Register (or refresh) a device token. Normally the client SDK does this; exposed for server-driven / BYO-token flows.

Parameters

Prop

Type

Returns array<mixed>

View source

unregister()

method
function unregister(string $token): array

Stop delivering to a device token (e.g. on logout / uninstall).

Parameters

Prop

Type

Returns array<mixed>

View source

PushBuilder

class
class Inverge\Nexus\Push\PushBuilder

Fluent builder for a transactional push. Compose content, rich per-platform options and the audience, then send().

$nexus->push()->notification()
    ->title('Your order shipped')
    ->body('Track it in the app')
    ->data(['screen' => '/orders/42'])
    ->button('track', 'Track', ['url' => 'https://x/track'])
    ->iosBadge(1)
    ->androidVisibility('public')
    ->setSegments(['vip', 'active_7d'])   // or ->toUsers([...]) / ->toAll()
    ->send();                              // → ['sent' => .., 'failed' => .., 'recipients' => ..]
View source

__construct

constructor
function __construct(Inverge\Nexus\NexusClient $client)

Parameters

Prop

Type

View source

title()

method
function title(string $title): self

Parameters

Prop

Type

Returns self

View source

body()

method
function body(string $body): self

Parameters

Prop

Type

Returns self

View source

image()

method
function image(string $url): self

Parameters

Prop

Type

Returns self

View source

data()

method
function data(array $data): self

Custom key/values delivered to the app (merged with any prior data).

Parameters

Prop

Type

Returns self

View source

button()

method
function button(string $id, string $text, array $opts = []): self

Add an action button. $opts: url, event, icon, style (primary|secondary|text).

Parameters

Prop

Type

Returns self

View source

iosBadge()

method
function iosBadge(int $count): self

Parameters

Prop

Type

Returns self

View source

iosRelevanceScore()

method
function iosRelevanceScore(float $score): self

Parameters

Prop

Type

Returns self

View source

iosInterruptionLevel()

method
function iosInterruptionLevel(string $level): self

Parameters

Prop

Type

Returns self

View source

iosSubtitle()

method
function iosSubtitle(string $subtitle): self

Parameters

Prop

Type

Returns self

View source

androidVisibility()

method
function androidVisibility(string $visibility): self

Android lockscreen visibility: public | private | secret. */

Parameters

Prop

Type

Returns self

View source

androidLargeIcon()

method
function androidLargeIcon(string $url): self

Parameters

Prop

Type

Returns self

View source

androidBigPicture()

method
function androidBigPicture(string $url): self

Parameters

Prop

Type

Returns self

View source

androidAccentColor()

method
function androidAccentColor(string $color): self

Parameters

Prop

Type

Returns self

View source

option()

method
function option(string $key, mixed $value): self

Set any option field directly (escape hatch). */

Parameters

Prop

Type

Returns self

View source

options()

method
function options(array $options): self

Merge multiple options at once.

Parameters

Prop

Type

Returns self

View source

toUsers()

method
function toUsers(array $distinctIds): self

Target specific users by distinctId.

Parameters

Prop

Type

Returns self

View source

toUser()

method
function toUser(string $distinctId): self

Parameters

Prop

Type

Returns self

View source

setSegments()

method
function setSegments(array $segmentIds): self

Target saved segments (union). setSegments / toSegments are aliases.

Parameters

Prop

Type

Returns self

View source

toSegments()

method
function toSegments(array $segmentIds): self

Parameters

Prop

Type

Returns self

View source

toSegment()

method
function toSegment(string $segmentId): self

Parameters

Prop

Type

Returns self

View source

where()

method
function where(array $filter): self

Target an ad-hoc device filter (platform, lang, osType, appVersion, lastSeenDays, tags).

Parameters

Prop

Type

Returns self

View source

toAll()

method
function toAll(): self

Target every subscribed device (overrides other targets). Use with care. */

Returns self

View source

send()

method
function send(): array

Deliver the notification.

Returns array<mixed> — { sent, failed, recipients }

View source

toArray()

method
function toArray(): array

The assembled request payload (without sending) — handy for testing.

Returns array<string, — mixed>

View source

On this page