PHP code example of zzl / umeng

1. Go to this page and download the library: Download zzl/umeng library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zzl / umeng example snippets


    composer reuqire zzl/umeng   

    'provider' => [
       Zzl\Umeng\UmengServiceProvider::class, 
    ],

    'aliases' => [
        'Umeng' => Zzl\Umeng\Facades\Umeng::class,
    ],

    php artisan vendor:publish   

    $app->register(Zzl\Umeng\UmengServiceProvider::class);

    class_alias('Zzl\Umeng\Facades\Umeng','Umeng');

    php artisan vendor:publish 


    use Umeng;
    
    $device_token = 'xxxx';
    $predefined = array('ticker' => 'android ticker' ,...);
    $extraField = array(); //other extra filed
    Umeng::android()->sendUnicast($device_token,$predefined,$extraField); //单播


    
    use Umeng;
    
    $device_token = 'xxxx';
    $predefined = array('alert' => 'ios alert' ,...);
    $customField = array(); //other custom filed
    Umeng::ios()->sendUnicast($device_token,$predefined,$customField); //单播
    

    
    sendBroadcast($predefined = [], $extraField = []); //广播
    sendUnicast($device_tokens = '', $predefined= [], $extraField = []); //单播
    sendListcast($device_tokens = '', $predefined= [], $extraField = []); //列播
    sendFilecast($fileContents = '', $predefined= [],$extraField = []); //文件播
    sendGroupcast($filter = [], $predefined= [], $extraField = []); //组播
    sendCustomizedcast($alias = '', $alias_type = '', $predefined= [], $extraField = []); //自定义播,通过alias
    sendCustomizedcastFileId($file_contents = '', $predefined= [], $extraField = []); //自定义播,通过file_id