Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ jobs:
fail-fast: false
max-parallel: 1 # Avoid rate-limit issue on Slack API
matrix:
php-version: [ '8.0', '8.1', '8.2' ]
php-version: [ '8.1', '8.2', '8.3', '8.4', '8.5' ]
composer-flags: [ '' ]
name: [ '' ]
include:
- php-version: 8.0
- php-version: 8.1
composer-flags: '--prefer-lowest'
name: '(prefer lowest dependencies)'

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Unreleased

## 4.9.0 (2026-03-10)

* Upgrade JanePHP generated code
* Dropped PHP 8.O support
* Added Symfony 8 support
* Removed `filesUpload` as it's not working anymore on Slack
* New `filesUploadV2` argument to publish in a thread

## 4.8.0 (2025-04-01)

* Upgrade JanePHP generated code
Expand Down
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# A PHP client for Slack's API
<h1 align="center">
<a href="https://github.com/jolicode/slack-php-api"><img src="https://jolicode.com/media/original/oss/headers/slack-php-api.png" alt="Slack PHP API"></a>
<br />
The Complete Slack SDK for PHP
<br />
<sub><em><h6>An automatically generated and up-to-date SDK.</h6></em></sub>
</h1>

<div align="center">

[![PHP Version Require](http://poser.pugx.org/jolicode/slack-php-api/require/php)](https://packagist.org/packages/jolicode/slack-php-api)
[![Monthly Downloads](http://poser.pugx.org/jolicode/slack-php-api/d/monthly)](https://packagist.org/packages/jolicode/slack-php-api)

</div>

There is a bunch of existing PHP clients for Slack. But some are not up-to-date
or miss features, some only cover a small part of the API and most are simply
Expand All @@ -8,7 +21,7 @@ This SDK is generated automatically with [JanePHP](https://github.com/janephp/ja
from the [official Slack API specs](https://github.com/slackapi/slack-api-specs).

It also provides a **full object-oriented interface** for all the endpoints,
requests and responses of the Slack Web API.
requests, and responses of the Slack Web API.

## Installation

Expand Down Expand Up @@ -55,7 +68,21 @@ Finally, some meta documentation:
* [versioning and branching models](VERSIONING.md)
* [contribution instructions](CONTRIBUTING.md)

## ⚠ Word of Warning

Slack decided a long time ago to abandon https://github.com/slackapi/slack-api-specs which held the reference
OpenAPI specification for the Slack API. This is a bummer for open-source, open formats, and interoperability.
This library survives on [patches from the community](resources/slack-openapi-sorted.patch)
to make the schema up to date and to add missing features.

## License

This library is licensed under the MIT License - see the [LICENSE](LICENSE.md)
file for details.

This project is not affiliated with Slack Technologies, LLC.

<br><br>
<div align="center">
<a href="https://jolicode.com/"><img src="https://jolicode.com/media/original/oss/footer-github.png?v3" alt="JoliCode is sponsoring this project"></a>
</div>
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@
},
"require": {
"ext-curl": "*",
"php": ">=8.0",
"jane-php/open-api-runtime": "^7.7",
"php": ">=8.1",
"jane-php/open-api-runtime": "^7.10",
"psr/http-client-implementation": "*",
"php-http/client-common": "^1.9 || ^2.0",
"php-http/discovery": "^1.11",
"php-http/multipart-stream-builder": "^1.1"
},
"require-dev": {
"jane-php/open-api-2": "~v7.6.0",
"symfony/http-client": "^6.0 || ^7.0",
"jane-php/open-api-2": "^7.10",
"symfony/http-client": "^6.0 || ^7.0 || ^8.0",
"nyholm/psr7": "^1.2",
"friendsofphp/php-cs-fixer": "^3.2.2",
"symfony/phpunit-bridge": "^6.0 || ^7.0",
"symfony/phpunit-bridge": "^6.0 || ^7.0 || ^8.0",
"opis/json-schema": "^1.0",
"symfony/console": "^6.0 || ^7.0",
"symfony/process": "^6.0 || ^7.0"
"symfony/console": "^6.0 || ^7.0 || ^8.0",
"symfony/process": "^6.0 || ^7.0 || ^8.0"
},
"conflict": {
"php-http/httplug": "< 2.0"
Expand Down
352 changes: 176 additions & 176 deletions generated/Client.php

Large diffs are not rendered by default.

162 changes: 48 additions & 114 deletions generated/Normalizer/AdminAppsApprovePostResponse200Normalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,141 +16,75 @@
use Jane\Component\JsonSchemaRuntime\Reference;
use JoliCode\Slack\Api\Runtime\Normalizer\CheckArray;
use JoliCode\Slack\Api\Runtime\Normalizer\ValidatorTrait;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) {
class AdminAppsApprovePostResponse200Normalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
class AdminAppsApprovePostResponse200Normalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use CheckArray;
use DenormalizerAwareTrait;
use NormalizerAwareTrait;
use ValidatorTrait;

public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
use CheckArray;
use DenormalizerAwareTrait;
use NormalizerAwareTrait;
use ValidatorTrait;
return \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200::class === $type;
}

public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200::class === $type;
}
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return \is_object($data) && \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200::class === \get_class($data);
}

public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return \is_object($data) && \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200::class === \get_class($data);
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (isset($data['$ref'])) {
return new Reference($data['$ref'], $context['document-origin']);
}

public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (isset($data['$ref'])) {
return new Reference($data['$ref'], $context['document-origin']);
}
if (isset($data['$recursiveRef'])) {
return new Reference($data['$recursiveRef'], $context['document-origin']);
}
$object = new \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200();
if (null === $data || false === \is_array($data)) {
return $object;
}
if (\array_key_exists('ok', $data) && null !== $data['ok']) {
$object->setOk($data['ok']);
unset($data['ok']);
} elseif (\array_key_exists('ok', $data) && null === $data['ok']) {
$object->setOk(null);
}
foreach ($data as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$object[$key] = $value;
}
}

if (isset($data['$recursiveRef'])) {
return new Reference($data['$recursiveRef'], $context['document-origin']);
}
$object = new \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200();
if (\array_key_exists('ok', $data) && \is_int($data['ok'])) {
$data['ok'] = (bool) $data['ok'];
}
if (null === $data || false === \is_array($data)) {
return $object;
}

public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
$data = [];
$data['ok'] = $object->getOk();
foreach ($object as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$data[$key] = $value;
}
if (\array_key_exists('ok', $data) && null !== $data['ok']) {
$object->setOk($data['ok']);
unset($data['ok']);
} elseif (\array_key_exists('ok', $data) && null === $data['ok']) {
$object->setOk(null);
}
foreach ($data as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$object[$key] = $value;
}

return $data;
}

public function getSupportedTypes(?string $format = null): array
{
return [\JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200::class => false];
}
return $object;
}
} else {
class AdminAppsApprovePostResponse200Normalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use CheckArray;
use DenormalizerAwareTrait;
use NormalizerAwareTrait;
use ValidatorTrait;

public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool
{
return \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200::class === $type;
}

public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return \is_object($data) && \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200::class === \get_class($data);
}

public function denormalize($data, $type, $format = null, array $context = [])
{
if (isset($data['$ref'])) {
return new Reference($data['$ref'], $context['document-origin']);
}
if (isset($data['$recursiveRef'])) {
return new Reference($data['$recursiveRef'], $context['document-origin']);
}
$object = new \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200();
if (null === $data || false === \is_array($data)) {
return $object;
}
if (\array_key_exists('ok', $data) && null !== $data['ok']) {
$object->setOk($data['ok']);
unset($data['ok']);
} elseif (\array_key_exists('ok', $data) && null === $data['ok']) {
$object->setOk(null);
}
foreach ($data as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$object[$key] = $value;
}
public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
$dataArray = [];
$dataArray['ok'] = $data->getOk();
foreach ($data as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$dataArray[$key] = $value;
}

return $object;
}

/**
* @return array|string|int|float|bool|\ArrayObject|null
*/
public function normalize($object, $format = null, array $context = [])
{
$data = [];
$data['ok'] = $object->getOk();
foreach ($object as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$data[$key] = $value;
}
}

return $data;
}
return $dataArray;
}

public function getSupportedTypes(?string $format = null): array
{
return [\JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200::class => false];
}
public function getSupportedTypes(?string $format = null): array
{
return [\JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200::class => false];
}
}
Loading