Skip to content

Beautiful Open-Source Form Builder

Separate slack channels (#843)

Chirag Chhatrala992d307d0fbc
diff --git a/api/.env.example b/api/.env.example
index b950810d9..f5c6ab9da 100644
--- a/api/.env.example
+++ b/api/.env.example
@@ -100,5 +100,4 @@ STRIPE_CLIENT_ID=
STRIPE_CLIENT_SECRET=
STRIPE_REDIRECT_URI=http://localhost:3000/connections/callback/stripe
-LOG_SLACK_WEBHOOK_URL=
-LOG_SLACK_CHURN_WEBHOOK_URL=
\ No newline at end of file
+SLACK_BOT_TOKEN=
\ No newline at end of file
diff --git a/api/app/Exceptions/Handler.php b/api/app/Exceptions/Handler.php
index 42101cbb1..f26a55c20 100644
--- a/api/app/Exceptions/Handler.php
+++ b/api/app/Exceptions/Handler.php
@@ -50,7 +50,7 @@ class Handler extends ExceptionHandler
if ($this->shouldReport($exception)) {
if (app()->bound('sentry') && $this->sentryShouldReport($exception)) {
app('sentry')->captureException($exception);
- Log::debug('Un-handled Exception: '.$exception->getMessage(), [
+ Log::debug('Un-handled Exception: ' . $exception->getMessage(), [
'exception' => $exception,
'file' => $exception->getFile(),
'line' => $exception->getLine(),
@@ -64,8 +64,13 @@ class Handler extends ExceptionHandler
public function render($request, Throwable $e)
{
- if ($this->shouldReport($e) && ! in_array(\App::environment(), ['testing']) && config('logging.channels.slack.enabled')) {
- Log::channel('slack')->error($e);
+ if ($this->shouldReport($e) && ! in_array(\App::environment(), ['testing'])) {
+ Log::channel('slack_errors')->error('Exception', [
+ 'exception' => $e,
+ 'file' => $e->getFile(),
+ 'line' => $e->getLine(),
+ 'trace' => $e->getTrace()
+ ]);
}
return parent::render($request, $e);
diff --git a/api/app/Http/Requests/UserFormRequest.php b/api/app/Http/Requests/UserFormRequest.php
index 10cb4953d..100a98e34 100644
--- a/api/app/Http/Requests/UserFormRequest.php
+++ b/api/app/Http/Requests/UserFormRequest.php
@@ -67,7 +67,7 @@ abstract class UserFormRequest extends \Illuminate\Foundation\Http\FormRequest
// Log to both default channel and Slack
if (!in_array(\App::environment(), ['testing'])) {
- Log::channel('combined')->warning(
+ Log::channel('slack_errors')->warning(
'Frontend validation bypass detected in form submission',
$logData
);
diff --git a/api/app/Logging/SlackLogHandler.php b/api/app/Logging/SlackLogHandler.php
new file mode 100644
index 000000000..3b5f3ed28
--- /dev/null
+++ b/api/app/Logging/SlackLogHandler.php
@@ -0,0 +1,190 @@
+<?php
+
+namespace App\Logging;
+
+use JoliCode\Slack\Api\Client;
+use JoliCode\Slack\ClientFactory;
+use Monolog\Handler\AbstractProcessingHandler;
+use Monolog\LogRecord;
+use Monolog\Level;
+use Exception;
+
+class SlackLogHandler extends AbstractProcessingHandler
+{
+ protected Client $client;
+ protected ?string $channel;
+ protected string $username;
+ protected string $emoji;
+
+ public function __construct(
+ string $token,
+ ?string $channel = null,
+ string $username = 'OpenForm Bot',
+ string $emoji = ':robot_face:',
+ int|string|Level $level = Level::Debug,
+ bool $bubble = true
+ ) {
+ $this->client = ClientFactory::create($token);
+ $this->channel = $channel;
+ $this->username = $username;
+ $this->emoji = $emoji;
+
+ parent::__construct($level, $bubble);
+ }
+
+ /**
+ * Write the record down to the log of the implementing handler
+ */
+ protected function write(LogRecord $record): void
+ {
+ try {
+ $blocks = $this->buildSlackBlocks($record);
+
+ $this->client->chatPostMessage([
+ 'channel' => $this->channel,
+ 'username' => $this->username,
+ 'icon_emoji' => $this->emoji,
+ 'blocks' => json_encode($blocks),
+ 'text' => $record->message, // Fallback for notifications
+ ]);
+ } catch (Exception $e) {
+ // Log the error without causing recursion
+ ray($e);
+ error_log("Failed to send Slack message: " . $e->getMessage());
+ }
+ }
+
+ /**
+ * Build Slack blocks from log record
+ */
+ protected function buildSlackBlocks(LogRecord $record): array
+ {
+ $blocks = [];
+
+ // Main message block
+ $messageText = $this->formatMessage($record);
+ $blocks[] = [
+ 'type' => 'section',
+ 'text' => [
+ 'type' => 'mrkdwn',
+ 'text' => $messageText,
+ ],
+ ];
+
+ // Add action buttons if provided in context
+ if (!empty($record->context['actions']) && is_array($record->context['actions'])) {
+ $elements = [];
+ foreach ($record->context['actions'] as $label => $url) {
+ $elements[] = [
+ 'type' => 'button',
+ 'text' => [
+ 'type' => 'plain_text',
+ 'text' => $label,
+ ],
+ 'url' => $url
+ ];
+ }
+
+ if (!empty($elements)) {
+ $blocks[] = [
+ 'type' => 'actions',
+ 'elements' => $elements,
+ ];
+ }
+ }
+
+ // Add additional context as fields if present
+ if (!empty($record->context) && $this->hasNonSpecialContextKeys($record->context)) {
+ $fields = [];
+ foreach ($record->context as $key => $value) {
+ // Skip special keys that we handle separately
+ if (in_array($key, ['actions'])) {
+ continue;
+ }
+
+ $fields[] = [
+ 'type' => 'mrkdwn',
+ 'text' => "*{$key}:* " . $this->formatContextValue($value),
+ ];
+ }
+
+ if (!empty($fields)) {
+ $blocks[] = [
+ 'type' => 'section',
+ 'fields' => $fields,
+ ];
+ }
+ }
+
+ // Add exception details if present
+ if (!empty($record->context['exception']) || !empty($record->extra['exception'])) {
+ $exception = $record->context['exception'] ?? $record->extra['exception'];
+ if ($exception instanceof Exception) {
+ $blocks[] = [
+ 'type' => 'section',
+ 'text' => [
+ 'type' => 'mrkdwn',
+ 'text' => "*Exception:* `" . get_class($exception) . "`\n" .
+ "*File:* `" . $exception->getFile() . ":" . $exception->getLine() . "`\n" .
+ "*Message:* " . $exception->getMessage(),
+ ],
+ ];
+ }
+ }
+
+ return $blocks;
+ }
+
+ /**
+ * Format the main log message with interpolation
+ */
+ protected function formatMessage(LogRecord $record): string
+ {
+ $message = $record->message;
+
+ // Perform simple string interpolation
+ if (!empty($record->context)) {
+ foreach ($record->context as $key => $value) {
+ // Skip special keys and complex objects
+ if (in_array($key, ['actions', 'exception']) || is_object($value) || is_array($value)) {
+ continue;
+ }
+
+ $message = str_replace('{' . $key . '}', (string) $value, $message);
+ }
+ }
+
+ return $message;
+ }
+
+ /**
+ * Format context value for display
+ */
+ protected function formatContextValue($value): string
+ {
+ if (is_array($value)) {
+ return json_encode($value, JSON_PRETTY_PRINT);
+ }
+
+ if (is_object($value)) {
+ return get_class($value);
+ }
+
+ if (is_bool($value)) {
+ return $value ? 'true' : 'false';
+ }
+
+ return (string) $value;
+ }
+
+ /**
+ * Check if context has keys other than special ones
+ */
+ protected function hasNonSpecialContextKeys(array $context): bool
+ {
+ $specialKeys = ['actions', 'channel', 'exception'];
+ $contextKeys = array_keys($context);
+
+ return !empty(array_diff($contextKeys, $specialKeys));
+ }
+}
diff --git a/api/app/Logging/SlackLoggerFactory.php b/api/app/Logging/SlackLoggerFactory.php
new file mode 100644
index 000000000..65850c985
--- /dev/null
+++ b/api/app/Logging/SlackLoggerFactory.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace App\Logging;
+
+use Monolog\Handler\NullHandler;
+use Monolog\Logger;
+
+class SlackLoggerFactory
+{
+ /**
+ * Create a custom Slack logger instance.
+ */
+ public function __invoke(array $config): Logger
+ {
+ $token = config('logging.slack.token');
+
+ // If no token is configured, use a null handler to silently ignore logs
+ if (empty($token)) {
+ return new Logger('slack', [new NullHandler()]);
+ }
+
+ $handler = new SlackLogHandler(
+ $token,
+ $config['channel'] ?? null
+ );
+
+ return new Logger('slack', [$handler]);
+ }
+}
diff --git a/api/app/Service/Forms/FormSpamService.php b/api/app/Service/Forms/FormSpamService.php
index c1f4cdd33..3f892224d 100644
--- a/api/app/Service/Forms/FormSpamService.php
+++ b/api/app/Service/Forms/FormSpamService.php
@@ -77,7 +77,7 @@ class FormSpamService
private function logAdminReview(Form $form, string $reason): void
{
- Log::channel('slack_churn')->warning('Form flagged for admin review 🚨', [
+ Log::channel('slack_alerts')->info('Form flagged for admin review 🚨', [
'form_id' => $form->id,
'form_title' => $form->title,
'user_id' => $form->creator->id,
@@ -86,7 +86,10 @@ class FormSpamService
'is_subscribed' => $form->creator->is_subscribed,
'total_forms' => $form->creator->forms()->count(),
'reason' => $reason,
- 'form_url' => config('app.client_url') . '/forms/' . $form->slug,
+ 'actions' => [
+ 'View Form' => front_url('/forms/' . $form->slug),
+ 'Admin Panel' => front_url('/admin?user_id=' . $form->creator->id),
+ ],
]);
Log::info('Form flagged for admin review', [
diff --git a/api/app/Service/UserActionService.php b/api/app/Service/UserActionService.php
index 9e158d524..512e0d055 100644
--- a/api/app/Service/UserActionService.php
+++ b/api/app/Service/UserActionService.php
@@ -25,11 +25,14 @@ class UserActionService
// Log to Slack
if (app()->environment() !== 'testing') {
- Log::channel('slack_churn')->info('User blocked 🚫', [
+ Log::channel('slack_admin')->info('User blocked 🚫', [
'user_id' => $user->id,
'email' => $user->email,
'reason' => $reason,
'moderator_id' => $moderatorId,
+ 'actions' => [
+ 'Admin Panel' => front_url('/admin?user_id=' . $user->id),
+ ]
]);
}
@@ -50,11 +53,14 @@ class UserActionService
// Log to Slack
if (app()->environment() !== 'testing') {
- Log::channel('slack_churn')->info('User unblocked 🔓', [
+ Log::channel('slack_admin')->info('User unblocked 🔓', [
'user_id' => $user->id,
'email' => $user->email,
'reason' => $reason,
'moderator_id' => $moderatorId,
+ 'actions' => [
+ 'Admin Panel' => front_url('/admin?user_id=' . $user->id),
+ ]
]);
}
diff --git a/api/composer.json b/api/composer.json
index d473df92e..42e85610b 100644
--- a/api/composer.json
+++ b/api/composer.json
@@ -20,6 +20,7 @@
"giggsey/libphonenumber-for-php": "*",
"google/apiclient": "^2.16",
"guzzlehttp/guzzle": "*",
+ "jolicode/slack-php-api": "^4.8",
"laravel/cashier": "*",
"laravel/framework": "^11.9",
"laravel/horizon": "*",
diff --git a/api/composer.lock b/api/composer.lock
index b46fd40f0..53e5f5fe9 100644
--- a/api/composer.lock
+++ b/api/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "344980a97a80d1594bc4679b28bd6209",
+ "content-hash": "1e57949df945ab435ed83204d339661a",
"packages": [
{
"name": "amphp/amp",
@@ -1095,6 +1095,72 @@
],
"time": "2024-02-09T16:56:22+00:00"
},
+ {
+ "name": "clue/stream-filter",
+ "version": "v1.7.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/clue/stream-filter.git",
+ "reference": "049509fef80032cb3f051595029ab75b49a3c2f7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/clue/stream-filter/zipball/049509fef80032cb3f051595029ab75b49a3c2f7",
+ "reference": "049509fef80032cb3f051595029ab75b49a3c2f7",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/functions_include.php"
+ ],
+ "psr-4": {
+ "Clue\\StreamFilter\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Christian Lück",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "A simple and modern approach to stream filtering in PHP",
+ "homepage": "https://github.com/clue/stream-filter",
+ "keywords": [
+ "bucket brigade",
+ "callback",
+ "filter",
+ "php_user_filter",
+ "stream",
+ "stream_filter_append",
+ "stream_filter_register"
+ ],
+ "support": {
+ "issues": "https://github.com/clue/stream-filter/issues",
+ "source": "https://github.com/clue/stream-filter/tree/v1.7.0"
+ },
+ "funding": [
+ {
+ "url": "https://clue.engineering/support",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/clue",
+ "type": "github"
+ }
+ ],
+ "time": "2023-12-20T15:40:13+00:00"
+ },
{
"name": "composer/pcre",
"version": "3.3.2",
@@ -3052,6 +3118,131 @@
},
"time": "2021-12-07T10:10:20+00:00"
},
+ {
+ "name": "jane-php/json-schema-runtime",
+ "version": "v7.9.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/janephp/json-schema-runtime.git",
+ "reference": "ddb82546a1fa29456fb9acaa3c1a299beb0b40b1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/janephp/json-schema-runtime/zipball/ddb82546a1fa29456fb9acaa3c1a299beb0b40b1",
+ "reference": "ddb82546a1fa29456fb9acaa3c1a299beb0b40b1",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "league/uri": "^6.7.2 || ^7.4",
+ "php": "^8.0",
+ "php-jsonpointer/php-jsonpointer": "^3.0 || ^4.0",
+ "symfony/serializer": "^5.4 || ^6.4 || ^7.0",
+ "symfony/yaml": "^5.4 || ^6.4 || ^7.0"
+ },
+ "conflict": {
+ "symfony/framework-bundle": "5.1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^8.5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-next": "7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Jane\\Component\\JsonSchemaRuntime\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Joel Wurtz",
+ "email": "[email protected]"
+ },
+ {
+ "name": "Baptiste Leduc",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "Jane runtime Library",
+ "support": {
+ "source": "https://github.com/janephp/json-schema-runtime/tree/v7.9.0"
+ },
+ "time": "2025-04-04T09:35:19+00:00"
+ },
+ {
+ "name": "jane-php/open-api-runtime",
+ "version": "v7.9.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/janephp/open-api-runtime.git",
+ "reference": "bf05ecae7096ccb3bd115fadb9b612e26c702d56"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/janephp/open-api-runtime/zipball/bf05ecae7096ccb3bd115fadb9b612e26c702d56",
+ "reference": "bf05ecae7096ccb3bd115fadb9b612e26c702d56",
+ "shasum": ""
+ },
+ "require": {
+ "jane-php/json-schema-runtime": "^7.0",
+ "nyholm/psr7": "^1.8",
+ "php": "^8.0",
+ "php-http/client-common": "^2.0",
+ "php-http/discovery": "^1.6",
+ "php-http/multipart-stream-builder": "^1.0",
+ "psr/http-client": "^1.0",
+ "psr/http-factory": "^1.0",
+ "symfony/options-resolver": "^5.4 || ^6.4 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^8.5",
+ "symfony/serializer": "^5.4 || ^6.4 || ^7.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-next": "7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Jane\\Component\\OpenApiRuntime\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Joel Wurtz",
+ "email": "[email protected]"
+ },
+ {
+ "name": "Baptiste Leduc",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "Jane OpenAPI Runtime Library, dependencies and utility class for a library generated by jane/openapi",
+ "support": {
+ "source": "https://github.com/janephp/open-api-runtime/tree/v7.9.0"
+ },
+ "time": "2025-04-17T14:07:07+00:00"
+ },
{
"name": "jean85/pretty-package-versions",
"version": "2.1.0",
@@ -3111,6 +3302,79 @@
},
"time": "2024-11-18T16:19:46+00:00"
},
+ {
+ "name": "jolicode/slack-php-api",
+ "version": "v4.8.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/jolicode/slack-php-api.git",
+ "reference": "59e617a0176f5d9579dc0ee935c8aeaa0e74c31c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/jolicode/slack-php-api/zipball/59e617a0176f5d9579dc0ee935c8aeaa0e74c31c",
+ "reference": "59e617a0176f5d9579dc0ee935c8aeaa0e74c31c",
+ "shasum": ""
+ },
+ "require": {
+ "ext-curl": "*",
+ "jane-php/open-api-runtime": "^7.7",
+ "php": ">=8.0",
+ "php-http/client-common": "^1.9 || ^2.0",
+ "php-http/discovery": "^1.11",
+ "php-http/multipart-stream-builder": "^1.1",
+ "psr/http-client-implementation": "*"
+ },
+ "conflict": {
+ "php-http/httplug": "< 2.0"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^3.2.2",
+ "jane-php/open-api-2": "~v7.6.0",
+ "nyholm/psr7": "^1.2",
+ "opis/json-schema": "^1.0",
+ "symfony/console": "^6.0 || ^7.0",
+ "symfony/http-client": "^6.0 || ^7.0",
+ "symfony/phpunit-bridge": "^6.0 || ^7.0",
+ "symfony/process": "^6.0 || ^7.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "JoliCode\\Slack\\": "src/",
+ "JoliCode\\Slack\\Api\\": "generated/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Loïck Piera",
+ "email": "[email protected]"
+ },
+ {
+ "name": "JoliCode",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "An up to date PHP client for Slack's API",
+ "keywords": [
+ "api",
+ "client",
+ "openapi",
+ "sdk",
+ "slack",
+ "slackapi",
+ "swagger"
+ ],
+ "support": {
+ "issues": "https://github.com/jolicode/slack-php-api/issues",
+ "source": "https://github.com/jolicode/slack-php-api/tree/v4.8.0"
+ },
+ "time": "2025-04-01T15:55:35+00:00"
+ },
{
"name": "kelunik/certificate",
"version": "v1.1.3",
@@ -6363,6 +6627,75 @@
],
"time": "2025-01-28T21:02:46+00:00"
},
+ {
+ "name": "php-http/client-common",
+ "version": "2.7.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-http/client-common.git",
+ "reference": "0cfe9858ab9d3b213041b947c881d5b19ceeca46"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-http/client-common/zipball/0cfe9858ab9d3b213041b947c881d5b19ceeca46",
+ "reference": "0cfe9858ab9d3b213041b947c881d5b19ceeca46",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0",
+ "php-http/httplug": "^2.0",
+ "php-http/message": "^1.6",
+ "psr/http-client": "^1.0",
+ "psr/http-factory": "^1.0",
+ "psr/http-message": "^1.0 || ^2.0",
+ "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0 || ^7.0",
+ "symfony/polyfill-php80": "^1.17"
+ },
+ "require-dev": {
+ "doctrine/instantiator": "^1.1",
+ "guzzlehttp/psr7": "^1.4",
+ "nyholm/psr7": "^1.2",
+ "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
+ "phpspec/prophecy": "^1.10.2",
+ "phpunit/phpunit": "^7.5.20 || ^8.5.33 || ^9.6.7"
+ },
+ "suggest": {
+ "ext-json": "To detect JSON responses with the ContentTypePlugin",
+ "ext-libxml": "To detect XML responses with the ContentTypePlugin",
+ "php-http/cache-plugin": "PSR-6 Cache plugin",
+ "php-http/logger-plugin": "PSR-3 Logger plugin",
+ "php-http/stopwatch-plugin": "Symfony Stopwatch plugin"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Http\\Client\\Common\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "Common HTTP Client implementations and tools for HTTPlug",
+ "homepage": "http://httplug.io",
+ "keywords": [
+ "client",
+ "common",
+ "http",
+ "httplug"
+ ],
+ "support": {
+ "issues": "https://github.com/php-http/client-common/issues",
+ "source": "https://github.com/php-http/client-common/tree/2.7.2"
+ },
+ "time": "2024-09-24T06:21:48+00:00"
+ },
{
"name": "php-http/discovery",
"version": "1.20.0",
@@ -6442,6 +6775,132 @@
},
"time": "2024-10-02T11:20:13+00:00"
},
+ {
+ "name": "php-http/httplug",
+ "version": "2.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-http/httplug.git",
+ "reference": "5cad731844891a4c282f3f3e1b582c46839d22f4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-http/httplug/zipball/5cad731844891a4c282f3f3e1b582c46839d22f4",
+ "reference": "5cad731844891a4c282f3f3e1b582c46839d22f4",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0",
+ "php-http/promise": "^1.1",
+ "psr/http-client": "^1.0",
+ "psr/http-message": "^1.0 || ^2.0"
+ },
+ "require-dev": {
+ "friends-of-phpspec/phpspec-code-coverage": "^4.1 || ^5.0 || ^6.0",
+ "phpspec/phpspec": "^5.1 || ^6.0 || ^7.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Http\\Client\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Eric GELOEN",
+ "email": "[email protected]"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "[email protected]",
+ "homepage": "https://sagikazarmark.hu"
+ }
+ ],
+ "description": "HTTPlug, the HTTP client abstraction for PHP",
+ "homepage": "http://httplug.io",
+ "keywords": [
+ "client",
+ "http"
+ ],
+ "support": {
+ "issues": "https://github.com/php-http/httplug/issues",
+ "source": "https://github.com/php-http/httplug/tree/2.4.1"
+ },
+ "time": "2024-09-23T11:39:58+00:00"
+ },
+ {
+ "name": "php-http/message",
+ "version": "1.16.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-http/message.git",
+ "reference": "06dd5e8562f84e641bf929bfe699ee0f5ce8080a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-http/message/zipball/06dd5e8562f84e641bf929bfe699ee0f5ce8080a",
+ "reference": "06dd5e8562f84e641bf929bfe699ee0f5ce8080a",
+ "shasum": ""
+ },
+ "require": {
+ "clue/stream-filter": "^1.5",
+ "php": "^7.2 || ^8.0",
+ "psr/http-message": "^1.1 || ^2.0"
+ },
+ "provide": {
+ "php-http/message-factory-implementation": "1.0"
+ },
+ "require-dev": {
+ "ergebnis/composer-normalize": "^2.6",
+ "ext-zlib": "*",
+ "guzzlehttp/psr7": "^1.0 || ^2.0",
+ "laminas/laminas-diactoros": "^2.0 || ^3.0",
+ "php-http/message-factory": "^1.0.2",
+ "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
+ "slim/slim": "^3.0"
+ },
+ "suggest": {
+ "ext-zlib": "Used with compressor/decompressor streams",
+ "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
+ "laminas/laminas-diactoros": "Used with Diactoros Factories",
+ "slim/slim": "Used with Slim Framework PSR-7 implementation"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/filters.php"
+ ],
+ "psr-4": {
+ "Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "HTTP Message related tools",
+ "homepage": "http://php-http.org",
+ "keywords": [
+ "http",
+ "message",
+ "psr-7"
+ ],
+ "support": {
+ "issues": "https://github.com/php-http/message/issues",
+ "source": "https://github.com/php-http/message/tree/1.16.2"
+ },
+ "time": "2024-10-02T11:34:13+00:00"
+ },
{
"name": "php-http/multipart-stream-builder",
"version": "1.4.2",
@@ -6498,6 +6957,114 @@
},
"time": "2024-09-04T13:22:54+00:00"
},
+ {
+ "name": "php-http/promise",
+ "version": "1.3.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-http/promise.git",
+ "reference": "fc85b1fba37c169a69a07ef0d5a8075770cc1f83"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-http/promise/zipball/fc85b1fba37c169a69a07ef0d5a8075770cc1f83",
+ "reference": "fc85b1fba37c169a69a07ef0d5a8075770cc1f83",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0"
+ },
+ "require-dev": {
+ "friends-of-phpspec/phpspec-code-coverage": "^4.3.2 || ^6.3",
+ "phpspec/phpspec": "^5.1.2 || ^6.2 || ^7.4"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Http\\Promise\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Joel Wurtz",
+ "email": "[email protected]"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "Promise used for asynchronous HTTP requests",
+ "homepage": "http://httplug.io",
+ "keywords": [
+ "promise"
+ ],
+ "support": {
+ "issues": "https://github.com/php-http/promise/issues",
+ "source": "https://github.com/php-http/promise/tree/1.3.1"
+ },
+ "time": "2024-03-15T13:55:21+00:00"
+ },
+ {
+ "name": "php-jsonpointer/php-jsonpointer",
+ "version": "v4.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/raphaelstolt/php-jsonpointer.git",
+ "reference": "fd50fc1aecd80dedb5bc59c9a1d70d4cfec7933b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/raphaelstolt/php-jsonpointer/zipball/fd50fc1aecd80dedb5bc59c9a1d70d4cfec7933b",
+ "reference": "fd50fc1aecd80dedb5bc59c9a1d70d4cfec7933b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.4"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^3.0",
+ "phpunit/phpunit": "8.*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Rs\\Json": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Raphael Stolt",
+ "email": "[email protected]",
+ "homepage": "http://raphaelstolt.blogspot.com/"
+ }
+ ],
+ "description": "Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)",
+ "homepage": "https://github.com/raphaelstolt/php-jsonpointer",
+ "keywords": [
+ "json",
+ "json pointer",
+ "json traversal"
+ ],
+ "support": {
+ "issues": "https://github.com/raphaelstolt/php-jsonpointer/issues",
+ "source": "https://github.com/raphaelstolt/php-jsonpointer/tree/v4.0.0"
+ },
+ "time": "2022-01-11T14:28:07+00:00"
+ },
{
"name": "phpdocumentor/reflection",
"version": "6.1.0",
@@ -11473,6 +12040,108 @@
],
"time": "2025-01-17T10:56:55+00:00"
},
+ {
+ "name": "symfony/serializer",
+ "version": "v7.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/serializer.git",
+ "reference": "0ed011583fd24899fa003abf77c45d4a901714da"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/serializer/zipball/0ed011583fd24899fa003abf77c45d4a901714da",
+ "reference": "0ed011583fd24899fa003abf77c45d4a901714da",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.2",
+ "symfony/deprecation-contracts": "^2.5|^3",
+ "symfony/polyfill-ctype": "~1.8"
+ },
+ "conflict": {
+ "phpdocumentor/reflection-docblock": "<3.2.2",
+ "phpdocumentor/type-resolver": "<1.4.0",
+ "symfony/dependency-injection": "<6.4",
+ "symfony/property-access": "<6.4",
+ "symfony/property-info": "<6.4",
+ "symfony/uid": "<6.4",
+ "symfony/validator": "<6.4",
+ "symfony/yaml": "<6.4"
+ },
+ "require-dev": {
+ "phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0",
+ "phpstan/phpdoc-parser": "^1.0|^2.0",
+ "seld/jsonlint": "^1.10",
+ "symfony/cache": "^6.4|^7.0",
+ "symfony/config": "^6.4|^7.0",
+ "symfony/console": "^6.4|^7.0",
+ "symfony/dependency-injection": "^7.2",
+ "symfony/error-handler": "^6.4|^7.0",
+ "symfony/filesystem": "^6.4|^7.0",
+ "symfony/form": "^6.4|^7.0",
+ "symfony/http-foundation": "^6.4|^7.0",
+ "symfony/http-kernel": "^6.4|^7.0",
+ "symfony/messenger": "^6.4|^7.0",
+ "symfony/mime": "^6.4|^7.0",
+ "symfony/property-access": "^6.4|^7.0",
+ "symfony/property-info": "^6.4|^7.0",
+ "symfony/translation-contracts": "^2.5|^3",
+ "symfony/type-info": "^7.1.8",
+ "symfony/uid": "^6.4|^7.0",
+ "symfony/validator": "^6.4|^7.0",
+ "symfony/var-dumper": "^6.4|^7.0",
+ "symfony/var-exporter": "^6.4|^7.0",
+ "symfony/yaml": "^6.4|^7.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Serializer\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "[email protected]"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/serializer/tree/v7.3.2"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/nicolas-grekas",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2025-07-26T13:07:17+00:00"
+ },
{
"name": "symfony/service-contracts",
"version": "v3.5.1",
@@ -15950,14 +16619,14 @@
],
"aliases": [],
"minimum-stability": "dev",
- "stability-flags": {},
+ "stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^8.2",
"ext-json": "*"
},
- "platform-dev": {},
+ "platform-dev": [],
"platform-overrides": {
"ext-pcntl": "8.0",
"ext-posix": "8.0"
diff --git a/api/config/logging.php b/api/config/logging.php
index 4d7f10d18..59099f6e9 100644
--- a/api/config/logging.php
+++ b/api/config/logging.php
@@ -28,12 +28,25 @@ return [
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
- | Available Drivers: "single", "daily", "slack", "syslog",
+ | Available Drivers: "single", "daily", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
+ /*
+ |--------------------------------------------------------------------------
+ | Slack Configuration
+ |--------------------------------------------------------------------------
+ |
+ | Configuration for Slack logging integration.
+ |
+ */
+
+ 'slack' => [
+ 'token' => env('SLACK_BOT_TOKEN'),
+ ],
+
'channels' => [
'stack' => [
'driver' => 'stack',
@@ -43,7 +56,7 @@ return [
'combined' => [
'driver' => 'stack',
- 'channels' => [env('LOG_CHANNEL') === 'combined' ? 'stack' : env('LOG_CHANNEL', 'stack'), 'slack'],
+ 'channels' => [env('LOG_CHANNEL') === 'combined' ? 'stack' : env('LOG_CHANNEL', 'stack'), 'slack_errors'],
'ignore_exceptions' => false,
],
@@ -60,21 +73,22 @@ return [
'days' => 14,
],
- 'slack' => [
- 'enabled' => env('LOG_SLACK_WEBHOOK_URL') ? true : false,
- 'driver' => 'slack',
- 'url' => env('LOG_SLACK_WEBHOOK_URL'),
- 'username' => 'OpenForm Log',
- 'emoji' => ':boom:',
- 'level' => env('LOG_LEVEL', 'debug'),
+ 'slack_errors' => [
+ 'driver' => 'custom',
+ 'via' => \App\Logging\SlackLoggerFactory::class,
+ 'channel' => env('SLACK_ERRORS_CHANNEL', '#errors-opnform'),
+ ],
+
+ 'slack_alerts' => [
+ 'driver' => 'custom',
+ 'via' => \App\Logging\SlackLoggerFactory::class,
+ 'channel' => env('SLACK_ALERTS_CHANNEL', '#alerts-opnform'),
],
- 'slack_churn' => [
- 'driver' => 'slack',
- 'url' => env('LOG_SLACK_CHURN_WEBHOOK_URL', env('LOG_SLACK_WEBHOOK_URL')),
- 'username' => 'OpenForm Churn Bot',
- 'emoji' => ':wave:',
- 'level' => 'info',
+ 'slack_admin' => [
+ 'driver' => 'custom',
+ 'via' => \App\Logging\SlackLoggerFactory::class,
+ 'channel' => env('SLACK_ADMIN_CHANNEL', '#admin-opnform'),
],
'papertrail' => [