PHP code example of affittocertificato / pushnotificationhandler

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

    

affittocertificato / pushnotificationhandler example snippets




$handler = new AffittoCertificato\NotificationHandler();

// this call register to a basic event named 'sharingCurriculum'. 
// In other words the method ->onCurriculum(...) is an alias to ->on('sharingCurriculum', ...)
$handler->onCurriculum(function($data){

  // do your logic with $data 
  // code ...
  // code ...
  // code ...
  // code ...
});


// this call register to an event named 'eventname_not_yet_implemented'
$handler->on('eventname_not_yet_implemented', function($data){
  return "You should implement this awesome event... really";
});

// run the push notification handler logic and return results to the AffittoCertificato caller
$handler->run();

// that's it!





$handler->onCurriculum(function($data){

  if (!isset ($data->curriculumLink))
    throw new Exception("Hey! You don't have passed me the link");


  // do some logics with curriculumLink
  // code ...
  // code ...
  // code ...
  // code ...
});





$handler->onCurriculum(function($data){

    // do your logics
  // code ...
  // code ...
  // code ...
  // code ...

  return "Have a nice day!";


});




$data->code; // is the code of rental listing you chose during button creation
$data->curriculumLink; // is the address that link to the tenant's curriculum
$data->userName; // Tenant's full name, such as "John Smith"