PHP code example of danharper / inbox-actions

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

    

danharper / inbox-actions example snippets



use DanHarper\InboxActions\InboxAction;

$action = InboxAction::ViewAction('View Report', 'http://example');

echo $action;



InboxAction::ViewAction('ViewReport', 'http://example')
	->publisher('Acme', 'http://acme');


use DanHarper\InboxActions\InboxAction;
use DanHarper\InboxActions\Schemas\PostalAddress;

InboxAction::RSVP('Taco Night')
	->at(new DateTime('2015-04-18 15:30'), new DateTime('2015-04-18 16:30'))
	->address(new PostalAddress(
		'Google', '24 Willie Mays Plaza', 'San Francisco', 'CA', '94107', 'USA'
	))
	->yes('http://acme')
	->no('http://acme')
	->maybe('http://acme');


InboxAction::RSVP('Taco Night')

	// you can define a date range with "at"
	->at(new DateTime('2015-04-18 15:30'), new DateTime('2015-04-18 16:30'))
	// OR you can define the dates separately
	->start(new DateTime('2015-04-18 15:30'))
	->finish(new DateTime('2015-04-18 16:30'))
	// you MUST define at least a start date
	
	// you can specify the address by providing an Address object:
	->address(new PostalAddress(
		'Google', '24 Willie Mays Plaza', 'San Francisco', 'CA', '94107', 'USA'
	))
	// OR with a callback where the address is given to you:
	->address(function(PostalAddress $adr) {
		// you can skip any of these fields
		$adr->name('Google')
			->street('24 Willie Mays Plaza')
			->city('San Francisco')
			->region('CA')
			->postCode('94107')
			->country('USA');
	})
	
	// you MUST specify both "yes" and "no" response URLs
	->yes('http://acme?response=yes')
	->no('http://acme?response=no')
	
	// you MAY specify a "maybe" response URL
	->maybe('http://acme?response=maybe')
	
	// by default, responses will be GET requests
	// you can be explicit, or use a POST request instead:
	->yes('http://acme', 'GET')
	->yes('http://acme', 'POST');


use DanHarper\InboxActions\InboxAction;

InboxAction::ConfirmAction('Approve Expense', 'http://acme.com');

// Also supports publisher details
InboxAction::ConfirmAction('Approve Expense', 'http://acme.com')
	->publisher('Acme', 'http://acme');

// Use POST for URL handler
InboxAction::ConfirmAction('Approve Expense')->handler('http://acme.com', 'POST');

// Require additional confirmation from user after clicking button
InboxAction::ConfirmAction('Approve Expense', 'http://acme')
	->