PHP code example of ejtj3 / teams

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

    

ejtj3 / teams example snippets




declare(strict_types=1);

use EJTJ3\Teams\Card;
use EJTJ3\Teams\Client;

$client = new Client('https://...');

$card = (new Card('Larry Bryant created a new task'))
    ->setText('Yes, he did')
    ->setThemeColor(Card::STATUS_DEFAULT)
    ->setTitle('Adding Title to the card');

$client->send($card);



declare(strict_types=1);

use EJTJ3\Teams\Card;
use EJTJ3\Teams\Section;

$card = new Card('Larry Bryant created a new task');

$section = (new Section('![TestImage](https://47a92947.ngrok.io/Content/Images/default.png)Larry Bryant created a new task'))
    ->setActivitySubtitle('On Project Tango')
    ->setActivityImage('https://teamsnodesample.azurewebsites.net/static/img/image5.png')
    ->addFact('Assigned to', 'Unassigned')
    ->addFact('Due date', 'Mon May 01 2017 17:07:18 GMT-0700 (Pacific Daylight Time)');

$card->addSection($section);



declare(strict_types=1);

use EJTJ3\Teams\Card;
use EJTJ3\Teams\Actions\ActionCard;
use EJTJ3\Teams\Actions\HttpPostAction;
use EJTJ3\Teams\Inputs\TextInput;

$card = new Card('Larry Bryant created a new task');

$actionCard = (new ActionCard('Add a comment'))
    ->addInput(new TextInput('comment', 'Add a comment here for this task'))
    ->addAction(new HttpPostAction('Add comment', 'http://...'));

$card->addPotentialAction($actionCard);