Download the PHP package nicklambourne/slackblocks without Composer
On this page you can find all versions of the php package nicklambourne/slackblocks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nicklambourne/slackblocks
More information about nicklambourne/slackblocks
Files in nicklambourne/slackblocks
Package slackblocks
Short Description Native, validated Slack Block Kit values for PHP
License MIT
Homepage https://slackblocks.ndl.au
Informations about the package slackblocks
slackblocks 
Build Slack messages in Python, TypeScript, Go, Java, C#, Ruby, Rust, PHP, or Elixir — without writing JSON by hand.
Anyone who has built a non-trivial Slack message knows the drill: a wall of nested
Block Kit JSON, five levels deep, where a typo'd
field name or an over-long string sails silently through your code and only blows up
when Slack rejects the API call. slackblocks replaces that JSON with typed objects
that assemble it for you — and that complain at construction time, in your editor and
your tests, rather than in production.
Why slackblocks?
- Concise —
SectionBlock("Hello, *world*!")/SectionBlock.builder().markdownText("Hello, *world*!").build()/new SectionBlock(text: "Hello, *world*!")instead of a ten-line JSON object. - Validated up front — character limits, required fields, mutually-exclusive options, and element-type restrictions are enforced when you construct the block, so you find out before hitting Slack's API.
- Typed — full type hints and
py.typedin Python, strict types in TypeScript, compile-checked concrete fluent builders in Go and Java, and typed constructors with nullable annotations in C#, RBS signatures in Ruby, and consuming builders with typed role enums in Rust, readonly classes with backed enums in PHP, and immutable structs with typespecs and atom enums in Elixir. - Plays well with established Slack clients — unpack a
Messagestraight intoclient.chat_postMessage(**message)withslack-sdk, pass a payload directly to@slack/web-api, pass Go block builders directly toslack-go/slack, pass Java blocks directly to the official Slack Java SDK, serialize C# values withSystem.Text.Json, callto_jsonon Ruby values, use Serde with Rust values, pass PHP JSON to JoliCode, cURL or Laravel, or send Elixir maps with Req or the community Slack client. - One contract across nine implementations — the same blocks, validation rules, and version numbers in Python, TypeScript, Go, Java, C#, Ruby, Rust, PHP, and Elixir. A shared conformance corpus keeps the implementations emitting the same Slack JSON.
- Everything Block Kit ships today — all current blocks and elements, rich text, modals and Home tabs, and the 2025 block families (tables, cards, carousels, charts).
- Light — zero runtime dependencies in Python, a self-contained ESM module on npm,
one direct Go dependency (
slack-go/slack), Java integration through the official Slack model interfaces, no dependencies beyond .NET itself in C#, Ruby's default JSON gem, Serde/serde_json in Rust, built-in JSON/PCRE extensions in PHP, and Jason/Decimal in Elixir.
Installation
Python (3.10+)
Earlier Pythons should pin the `1.x` line, see [Compatibility](https://nicklambourne.github.io/slackblocks/usage/compatibility).TypeScript / JavaScript (Node 20.19+ or 22.12+, ESM)
Go (1.22+)
Java (17+)
C# (.NET 8+)
Ruby (3.3+)
Rust (1.85+, edition 2024)
PHP (8.2+, 64-bit)
PHP support begins with coordinated version 2.7.0. See the [PHP package guide](php/README.md) for native usage and development setup.Elixir (1.16.3+, compatible OTP 26.2+, 64-bit)
Add the [Hex package](https://hex.pm/packages/slackblocks) to your dependencies in `mix.exs`: Run `mix deps.get`. If Jason was compiled before Decimal was installed, run `mix deps.compile jason --force` in each build environment and rebuild the application/release. See the [Elixir package guide](elixir/README.md).Quickstart
Python
A CI notification: Send it in one line with the official Slack SDK — the `**` operator unpacks `Message` objects directly into the call, no `to_dict()` boilerplate:TypeScript / JavaScript
Go
Java
C#
Ruby
Rust
The same validated construction in Rust uses consuming builders and native errors: Values own their data, getters borrow, and `clone().into_builder()` supports editing without mutating the original. See the [Rust package guide](rust/README.md) and [Rust API reference](https://nicklambourne.github.io/slackblocks/reference/rust).PHP
The same construction in PHP uses readonly classes and named arguments: See the [PHP package guide](php/README.md), [sending integrations](php/integrations/README.md), and [PHP API reference](https://nicklambourne.github.io/slackblocks/reference/php).Elixir
Native structs use keyword constructors and atom enums. Tagged functions return `{:ok, value}` or `{:error, error}`; bang functions raise. Send the resulting map with Req or the community client. See the [Elixir package guide](elixir/README.md), [sending integrations](elixir/integrations/README.md), [API reference](https://nicklambourne.github.io/slackblocks/reference/elixir) and [Erlang example](elixir/erlang/src/slackblocks_erlang.erl).
Documentation
- Full docs: https://nicklambourne.github.io/slackblocks/
- Installation
- Using Blocks — every block type with code in all nine languages, the JSON it produces, and screenshots.
- Sending Messages
- Recipe Book — end-to-end recipes for build notifications, approval requests, modals, and more.
- API Reference — Python, TypeScript, Go, Java, C#, Ruby, and Rust, PHP, and Elixir.
- Migrating from 1.x · Troubleshooting & FAQ
- Changelogs: Elixir
- Roadmap — including the TypeScript legacy API removal planned for v3.0.
Repository layout
python/— the established Python package (slackblockson PyPI).typescript/— the TypeScript package (@nicklambourne/slackblockson npm).go/— the Go v2 module (github.com/nicklambourne/slackblocks/go/v2).java/— the Java artifact (io.github.nicklambourne:slackblockson Maven Central).csharp/— the .NET package (Slackblockson NuGet).ruby/— the Ruby gem (slackblockson RubyGems from 2.5.0).rust/— the Rust crate (slackblockson crates.io from 2.6.0).php/— native PHP values and Composer package (nicklambourne/slackblockson Packagist from 2.7.0).elixir/— native Elixir values and Erlang integration (slackblockson Hex from 2.8.0).spec/— the shared conformance contract: fixtures, invalid cases, limits, and capability coverage that all nine implementations are tested against.docs/— the Docusaurus documentation site.
Download statistics
The Downloads badge sums all-time counts from PyPI (via Pepy), npm, NuGet, RubyGems, crates.io, Packagist, and Hex. Go and Maven Central have no comparable public all-time download counters and are excluded. Registry counting rules differ; these counts include automated downloads and do not represent unique users. The total refreshes hourly and shows unavailable if any contributing count is missing or more than 24 hours old.
Licensing
slackblocks is dual-licensed under MIT and
BSD-3-Clause. Use whichever fits your project — this makes it
safe to vendor into projects under either license.
Contributing
Contributions are welcome. Python development uses uv from
python/; TypeScript and the docs site use pnpm from the repository
root:
Elixir contributors use the pinned formatter toolchain and mix run tools/check.exs from elixir/;
see native checks for packaging, Erlang, sending and quality prerequisites.
For the full development guide — testing conventions, the conformance-fixture workflow, docstring style, and the release process — see the Contributing page.
Adding a newly released Slack component or field? Follow the in-repo Adding New Block Kit Features for the shared contract, implementation, test, and documentation checklist.
Adding a new language? Follow the in-repo language implementation guide for native API design, parity, testing, documentation, packaging and release integration.
Bug reports and feature requests: https://github.com/nicklambourne/slackblocks/issues.
All versions of slackblocks with dependencies
php-64bit Version >=8.2
ext-json Version *
ext-pcre Version *