PHP code example of ocolin / pushover

1. Go to this page and download the library: Download ocolin/pushover 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/ */

    

ocolin / pushover example snippets



$_ENV['PUSHOVER_API_TOKEN'] = 'yourauthtokenhere';

$client = new Ocolin\Pushover\Client();


$client = new Ocolin\Pushover\Client(
      token: 'yourauthtokenhere',
     format: 'json',
     verify: true,
    timeout: 20
);

$output = $client->message->push(
       user: 'kjhs6fjhk2jhsf19hj',
    message: 'This is a message body',
     params: [ 'title' => 'This is a title' ]
);

$output = $client->message->get(
    secret: 'KJHd7hsjqk3jh',
    device_id: 'kljshdf62j10'
);

$output = $client->groups->create(
    name: 'MyGroup'
);


$output = $client->groups->groups();

$output = $client->groups->get( group: 'kjhJHf7hJh72jh' );

$output = $client->groups->addUser(
    group: 'KJHjhdfkjsd',
     user: 'gRhdnml6gsji8df'
);

$output = $client->groups->removeUser(
    group: 'KJHjhdfkjsd',
     user: 'gRhdnml6gsji8df'
);

$output = $client->groups->disableUser(
    group: 'KJHjhdfkjsd',
     user: 'gRhdnml6gsji8df'
);

$output = $client->groups->enableUser(
    group: 'KJHjhdfkjsd',
     user: 'gRhdnml6gsji8df'
);

$output = $client->groups->rename(
    group: 'KJHjhdfkjsd',
     name: 'New Name'
);

$output = $client->receipts->get( receipt: 'JKHk1262jhfs' );

$output = $client->receipts->cancel( receipt: 'JKHk1262jhfs' );

$output = $client->receipts->cancelByTag( tag: 'MyTag' );

$output = $client->receipts->acknowledge(
    receipt: 'KJHd7hsjqk3jh',
    secret: 'JKHk1262jhfs'
);

$output = $client->apps->limits();

$output = $client->devices->register(
    secret: 'jhdD87hKjhd8h',
      name: 'My device',
        os: 'O'
);

$output = $client->devices->delete(
    device_id: 'lkjskdjsdf',
       secret: 'sdfgsdfgdf',
      message: 2
);

$output = $client->glances->update(
    user: 'KJHjdk8h9dsf',
    params: [ 'text' => 'Message to widget' ]
);

$output = $client->licenses->assign(
    email: '[email protected]'
);

$output = $client->licenses->check();

$output = $client->subscriptions->migrate(
    subscription: 'kjh234jhf8',
            user: 'VB2bc34nfgg'
);

$output = $client->teams->show( team: 'kjh234he8hhj' );

$output = $client->teams->add(
    email: '[email protected]',
    params: [
        'password' => 'MyPassword'
    ]
);

$output = $client->teams->remove(
    email: '[email protected]'
);

$output = $client->users->validate();

$output = $client->users->login(
    email: '[email protected]',
    password: 'mypassword123'
);

$output = $client->sounds->list();