danielhe4rt / kick-php-sdk
1.0.0
2025-03-17 06:19 UTC
Requires
- php: ^8.2
- ext-openssl: *
- guzzlehttp/guzzle: ^7.9
- symfony/http-foundation: ^7.2
Requires (Dev)
- laravel/pint: ^1.21
- pestphp/pest: ^3.7
README
Kick PHP SDK
A PHP SDK for interacting with the Kick.com API. This SDK provides a simple and intuitive way to authenticate with Kick's OAuth 2.0 implementation and interact with various Kick API endpoints.
Requirements
- PHP 8.2 or higher
- Composer
Installation
composer require danielhe4rt/kick-php-sdk
Usage
use DanielHe4rt\KickSDK\KickClient; $clientId = 'your-client-id'; $clientSecret = 'your-client-secret'; $kickClient = new KickClient( clientId: $clientId, clientSecret: $clientSecret, ); $redirectUrlDTO = RedirectUrlDTO::make( clientId: $clientId, redirectUri: 'http://localhost:8000/oauth/kick', responseType: 'code', scopes: [KickOAuthScopesEnum::USER_READ, KickOAuthScopesEnum::EVENTS_SUBSCRIBE], state: md5(time()), ); echo $redirectUrlDTO->codeChallenge->getVerifier() . PHP_EOL; $redirectUrl = $kickClient->oauth()->redirectUrl($redirectUrlDTO); echo $redirectUrl . PHP_EOL; echo "Paste the code you received in the redirect URL: "; $code = trim(fgets(STDIN)); $authDTO = AuthenticateDTO::make( code: $code, codeVerifier: $redirectUrlDTO->codeChallenge->getVerifier(), redirectUrl: 'http://localhost:8000/oauth/kick', ); $authToken = $kickClient->oauth()->authenticate($authDTO); echo "Access Token: " . $authToken->accessToken . PHP_EOL; echo "Refresh Token: " . $authToken->refreshToken . PHP_EOL; $usersClient = $kickClient->users($authToken->accessToken); $authenticatedUser = $usersClient->me(); echo "Authenticated User ID: " . $authenticatedUser->userId . PHP_EOL; echo "Authenticated User Username: " . $authenticatedUser->username . PHP_EOL; echo "Authenticated User Profile Picture: " . $authenticatedUser->profile_picture . PHP_EOL; echo "Authenticated User Email: " . ($authenticatedUser->email ?? 'Not provided. See scopes') . PHP_EOL;
See examples for more usage examples. We also will be providing a Webhook handler soon.
Roadmap
- Finish implementing all resources
- Add comprehensive test coverage (90%+)
- Add more examples and documentation
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Credits
- danielhe4rt - Creator and maintainer