Search by

garis-kode / adaptivecard-php

gariskode

Fluent PHP builder that programmatically constructs Microsoft Adaptive Card (v1.6) JSON payloads.

Package info

github.com/garis-kode/adaptivecard-php

pkg:composer/garis-kode/adaptivecard-php

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 3

v1.0.1 2026-10-25 13:06 UTC

This package is auto-updated.

Last update: 2026-11-01 04:10:22 UTC


README

Microsoft Adaptive Cards builder for PHP

Latest Version on Packagist Software License PHP Version Total Downloads

Overview

A fluent, fully typed PHP builder for Microsoft Adaptive Cards.

Requirements

  • PHP: >= 8.1
  • Extensions: ext-json

Installation

Install the package via Composer:

composer require garis-kode/adaptivecard-php

Quick Start

Create an Adaptive Card with a formatted text block and an action button, and export to JSON:

<?php

declare(strict_types=1);

require_once __DIR__ . '/vendor/autoload.php';

use AdaptiveCards\Action\OpenUrl\OpenUrlAction;
use AdaptiveCards\AdaptiveCard;
use AdaptiveCards\Element\TextBlock;
use AdaptiveCards\Enum\TextSize;
use AdaptiveCards\Enum\TextWeight;

$card = AdaptiveCard::make('1.6') // Version defaults to '1.6' if omitted
    ->addTextBlock('Hello from Adaptive Cards!', function (TextBlock $t): void {
        $t->size(TextSize::Large)
            ->weight(TextWeight::Bolder);
    })
    ->addAction(OpenUrlAction::make('https://adaptivecards.io/', 'Learn More'));

// Output JSON string
echo $card->toJson();

Expected Output

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.6",
    "body": [
        {
            "type": "TextBlock",
            "text": "Hello from Adaptive Cards!",
            "size": "Large",
            "weight": "Bolder"
        }
    ],
    "actions": [
        {
            "type": "Action.OpenUrl",
            "url": "https://adaptivecards.io/",
            "title": "Learn More"
        }
    ]
}

Documentation

For comprehensive schema specifications, interactive designer, and payload samples, refer to the official Adaptive Cards Documentation.

Changelog

This project adheres to Semantic Versioning. For a complete record of updates and release notes, visit the GitHub Releases page.

License & Credits

  • License: Released under the MIT License. Copyright © 2026 Garis Kode.
  • Adaptive Cards Specification: Adaptive Cards is an open card exchange format developed by Microsoft. Learn more at Adaptive Cards.