PHPackages                             ak86/slash-command-request-validator-for-slack - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. ak86/slash-command-request-validator-for-slack

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

ak86/slash-command-request-validator-for-slack
==============================================

A simple PHP package for validating the requests sent through a slack app slash commands.

v1.0.5(4y ago)042MITPHPPHP &gt;=5.6

Since Oct 2Pushed 4y ago1 watchersCompare

[ Source](https://github.com/amilak86/slash-command-request-validator-for-slack)[ Packagist](https://packagist.org/packages/ak86/slash-command-request-validator-for-slack)[ RSS](/packages/ak86-slash-command-request-validator-for-slack/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (6)DependenciesVersions (7)Used By (0)

Slash Command Request Validator for Slack Apps
==============================================

[](#slash-command-request-validator-for-slack-apps)

A simple PHP package for validating the requests sent through a slack app slash commands. The package aims to address the HTTP endpoint requirements outlined as follows:

- Validates the HTTP request method to make sure it is a POST
- Validates **X-Slack-Request-Timestamp** header to mitigate replay attacks
- Validates the HTTP payload to make sure it is not empty
- Verifies the slack request signature

Please refer to below Slack documentation for the complete information on its endpoint requirements:

- [Enabling interactivity with Slash Commands](https://api.slack.com/interactivity/slash-commands)
- [Verifying requests from Slack](https://api.slack.com/authentication/verifying-requests-from-slack)

Requirements
------------

[](#requirements)

- PHP 5.6 or higher
- Slack Signing Secret

Installation
------------

[](#installation)

You can install the package with Composer, by running the below command in your project root folder:

```
composer require ak86/slash-command-request-validator-for-slack

```

Make sure to add your **Slack Signing Secret** as an environment variable on your server where you run your script. The environment variable should be named `SLACK_SIGNING_SECRET`. You can find your **Slack Signing Secret** in the **Basic Information** section of your Slack App's admin dashboard.

Basic Usage
-----------

[](#basic-usage)

In your app where slack slash command is configured to send its requests:

```
// require composer autoloader
require_once 'vendor/autoload.php';

use Ak86\SlashCommandRequestValidator;

try {
	// simply call validate() static method to validate the incoming request
	SlashCommandRequestValidator::validate()
}
catch (Exception $e){
	echo $e->getMessage();
	exit;
}

```

Optionally, you can set the number of seconds since the originating timestamp which is used to determine for how long the request can be considered as safe:

```
// set the number of seconds
SlashCommandRequestValidator::reqAllowedWithin = 500;

// call validator
SlashCommandRequestValidator::validate()

```

License
-------

[](#license)

[MIT](./LICENSE)

Author
------

[](#author)

[Amila Kalansooriya](https://www.linkedin.com/in/amilakalansooriya/)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

6

Last Release

1675d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4582c8c89cd45ad0e7637274649104efd7b97b2cb15b2ee1adf911b76b84ed42?d=identicon)[amilak86](/maintainers/amilak86)

---

Top Contributors

[![amilak86](https://avatars.githubusercontent.com/u/28174846?v=4)](https://github.com/amilak86 "amilak86 (8 commits)")

### Embed Badge

![Health badge](/badges/ak86-slash-command-request-validator-for-slack/health.svg)

```
[![Health](https://phpackages.com/badges/ak86-slash-command-request-validator-for-slack/health.svg)](https://phpackages.com/packages/ak86-slash-command-request-validator-for-slack)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
