Releases: jeremeamia/slack-block-kit
Releases · jeremeamia/slack-block-kit
v0.16.0
v0.15.0
- Added
Message::fallbackText()
for setting the legacy"text"
property on a message.- This property is useful in Block Kit as a fallback when a message is displayed in a context where Block Kit is not (yet) supported.
- Added
Message::asPreviewableMessage()
to convert an existingMessage
object to one compatible withKit::preview()
.
v0.14.0
- Added new
Formatter
class that provides several helper methods for Slack's mrkdwn features. - Added
Attachment::asMessage()
to be able to quickly create a message wrapper for an attachment. - Added new
Config
class that provides a way to set the defaultverbatim
andemoji
arguments fortext
elements. - Updated the
Kit
façade to include the ability to access singleton instances ofFormatter
andConfig
. - Updated all
MrkdwnText
generating functions to to make the$verbatim
argumentnull
by default. - Updated all
text
elements to defer theirverbatim
andemoji
values (ifnull
) to what is set in theKit
'sConfig
. - Updated
Kit
to move Block Kit Builder preview functionality into a newPreviewer
class (still accessible viaKit::preview()
).
Kit::config()->setDefaultVerbatimSetting(false);
$f = Kit::formatter();
$msg = Kit::newMessage()->text(<<<MRKDWN
{$f->escape('<&>')}
{$f->bold('hello')} world
{$f->italic('hello')} world
{$f->strike('hello')} world
{$f->code('hello')} world
{$f->blockQuote("this\nis\na\nblockquote")}
{$f->codeBlock("this\nis\na\ncode block")}
{$f->bulletedList(['this', 'is', 'a', 'bulleted list'])}
{$f->numberedList(['this', 'is', 'a', 'numbered list'])}
Today is {$f->date(time(), Formatter::DATE_LONG)}
Link: {$f->link('http://google.com', 'Google')}
MailTo: {$f->emailLink('[email protected]', 'Email Jeremy')}
Join {$f->channel('general')}
Talk to {$f->user('jeremy.lindblom')}
Talk to {$f->userGroup('devs')}
Hey {$f->atHere()}
Hey {$f->atChannel()}
Hey {$f->atEveryone()}
MRKDWN);
$url = Kit::preview($msg);
v0.13.1
- Added missing
file
block element (needed for hydration). - Added missing shortcut
header()
method for surfaces to add aheader
element.
v0.13.0
- (BC) Raised minimum PHP version to PHP 7.3.
- (BC) Renamed
Slack
class toKit
. - (BC) Removed the
Renderer
interface and allRenderers
implementations and factories.- You can use the new
Kit::preview()
orElement::toJson(true)
to replace theKitBuilder
andJson
renderers, respectively.
- You can use the new
- (Deprecated) Marked
MultiSelectMenu::setMaxSelectedItems()
as deprecated in favor ofMultiSelectMenu::maxSelectedItems()
. - ⭐ Added support for element/surface hydration from JSON data to object (e.g.,
Message::fromArray()
). - Added
Element::fromJson()
andElement::toJson()
as convenience wrappers offromArray()
andtoArray()
. - Added support for the missing
header
block element. - Added support for the
filter
property of conversation select menus. - Added
Kit::preview()
method to generate a link to the interactive Block Kit Builder containing the surface's content for preview. - Added
Type::mapType()
method for looking up a type's class. - Added
MultiSelectMenu::maxSelectedItems()
to match desired convention. - Added some additional setters on elements (e.g.,
addOptionGroup()
) to assist with hydration implementation. - Fixed
PlainText
class to only includeemoji
property is explicitly set. - Fixed some return types, including in doc-blocks (e.g.,
@return self
->@return static
).
v0.12.0
- Added support for the
Attachment
surface which can exist inside aMessage
. - Added support for adding attachments to messages.
- Updated
KitRenderer
to use new the Block Kit Builder URL format. - Added a new, standalone
OptionList
element, which can be used as a response to ablock_suggestion
request.
v0.11.0
- Added the
Element::tap()
method, which allows for an improved fluent interface in some cases. You can pass a closure for modifying the element, but still return the original element.
v0.10.1
- Fixed
Message::$directives
property to have a default value of[]
.
v0.10.0
- Added support for the new
timepicker
input element. - Added support for the
workflow_step
surface (a special case ofmodal
). - Updated
Message
class to:- Support additional directives like
replace_original
anddelete_original
- Only include
response_type
when explicitly configured.
- Support additional directives like
v0.9.0
HasOptions
has new ways to add options, including initial options. Also has validations for initial options.- New
OptionsConfig
class to help parameterizeHasOptions
behavior. - Adds
setExtra
to baseElement
object to allow for patching on new Slack features in a non-conflicting way prior to the library being updated. - Adds some missing/new fields to some menus.