Overview

Namespaces

  • LeanCloud
    • Engine
    • Operation
    • Storage
    • Uploader

Classes

  • ACL
  • AppRouter
  • Bytes
  • Client
  • File
  • GeoPoint
  • LeanObject
  • MIMEType
  • Push
  • Query
  • Region
  • Relation
  • Role
  • RouteCache
  • SaveOption
  • SMS
  • User

Exceptions

  • BatchRequestError
  • CloudException
  • Overview
  • Namespace
  • Class

Class Push

Send Push notification to mobile devices

Namespace: LeanCloud
Located at LeanCloud/Push.php
Methods summary
public
# __construct( array $data = array(), array $options = array() )

Initialize a Push notification

Initialize a Push notification

Parameters

$data
Notification data
$options
Notification options

See

self::setData, self::setOption
public LeanCloud\Push
# setData( string $key, mixed $val )

Set notification data attributes

Set notification data attributes

Available attributes please see https://leancloud.cn/docs/push_guide.html#%E6%8E%A8%E9%80%81%E6%B6%88%E6%81%AF

Parameters

$key
Attribute key
$val
Attribute value

Returns

LeanCloud\Push
public LeanCloud\Push
# setOption( string $key, mixed $val )

Set general option for notificiation

Set general option for notificiation

Available options please see https://leancloud.cn/docs/push_guide.html#%E6%8E%A8%E9%80%81%E6%B6%88%E6%81%AF

There are helper methods for setting most of options, use those if possible. Use this when no helper present, e.g. to enable "dev" environment in iOS:

$push->setOption("prod", "dev");

Parameters

$key
Option key
$val
Option value

Returns

LeanCloud\Push

See

self::setWhere, self::setChannels, self::setPushTime ...
public LeanCloud\Push
# setChannels( array $channels )

Set target channels

Set target channels

Parameters

$channels
List of channel names

Returns

LeanCloud\Push

See

self::setOption()
public LeanCloud\Push
# setWhere( LeanCloud\Query $query )

Filter target devices by query

Filter target devices by query

The query must be over _Installation table.

Parameters

$query
A query over _Installation

Returns

LeanCloud\Push

See

self::setOption()
public LeanCloud\Push
# setPushTime( DateTime $time )

Schedule a time to send message

Schedule a time to send message

Parameters

$time
Time to send message to clients

Returns

LeanCloud\Push

See

self::setOption()
public LeanCloud\Push
# setExpirationInterval( integer $interval )

Set expiration interval for message

Set expiration interval for message

When client received message after the interval, it will not be displayed to user.

Parameters

$interval
Number of seconds (from now) to expire message

Returns

LeanCloud\Push

See

self::setOption()
public LeanCloud\Push
# setExpirationTime( DateTime $time )

Set expiration time for message

Set expiration time for message

When client received message after the specified time, it will not be displayed to user.

Parameters

$time
Time to expire message

Returns

LeanCloud\Push

See

self::setOption()
public LeanCloud\Push
# setFlowControl( integer $flowControl )

Enable smooth push for message

Enable smooth push for message

Parameters

$flowControl

clients to push per second, a value <1000 is equivalent to 1000.

Returns

LeanCloud\Push

See

self::setOption()
public array
# encode( )

Encode to JSON representation

Encode to JSON representation

Returns

array
public array
# send( )

Send notification to LeanCloud

Send notification to LeanCloud

Returns

array
API documentation generated by ApiGen