future-station / keyguard
A PHP package for validating API keys, secrets, and tokens for popular services.
Requires
- php: ^8.1
- php-http/discovery: ^1.19
- php-http/guzzle7-adapter: ^1.0
- psr/http-client: ^1.0
- psr/http-client-implementation: ^1.0
- psr/http-factory: ^1.1
- psr/http-factory-implementation: *
- psr/http-message: ^1.1|^2.0
Requires (Dev)
- guzzlehttp/psr7: ^2.7
- laravel/pint: ^1.17
- mockery/mockery: ^1.6
- pestphp/pest: ^2.35
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-type-coverage: ^2.8
- phpstan/phpstan: ^1.11
- rector/rector: ^1.2
- symfony/var-dumper: ^6.4
README
KeyGuard is a powerful PHP package designed to validate API keys, secrets, access tokens, and HMACs for popular services like OpenAI, GitHub, Shopify, and more. This tool is essential for developers and businesses that depend on secure and accurate validation of their API credentials.
Contributors
This package is made possible thanks to the contributions of these developers:
If you or your organization benefits from using KeyGuard, please consider supporting the developers who have invested their time and expertise into creating and maintaining this invaluable tool.
Get Started
Prerequisite: PHP 8.1 or higher is required. Download PHP
Installation
To begin using KeyGuard, install the package via Composer:
composer require future-station/keyguard
If your project does not already include a PSR-18 HTTP client, ensure the php-http/discovery
plugin is enabled, or manually install a compatible client such as Guzzle:
composer require guzzlehttp/guzzle
Usage Example
Below is a basic example demonstrating how to validate a GitHub API key using KeyGuard:
$yourApiKey = 'YOUR_API_KEY'; $keyguard = new KeyGuard(); $result = $keyguard ->validate(ServiceType::GITHUB, $yourApiKey); echo $result->value; // Output: valid
License
KeyGuard is open-source software licensed under the BSD 3-Clause License.