Laravel Twitch is a package that provides an easy way to interact with the Twitch API using Laravel. It simplifies the process of making requests to the Twitch API and handling the responses. The package includes features such as authentication, making API requests, and handling pagination.
To install the package, you can use Composer:
composer require farzai/twitch
The package requires PHP 8.1 or higher and the following dependencies:
- spatie/laravel-package-tools: ^1.14.0
- illuminate/contracts: ^10.0
Here are some examples of how to use the package:
use Farzai\Twitch\Authorizer;
$accessToken = Authorizer::retrieveAccessToken();
use Farzai\Twitch\Builder;
use Farzai\Twitch\Models\Game;
$builder = new Builder(Game::class);
$games = $builder->search('Fortnite')->get();
To configure the package, you need to set up the necessary credentials in your .env
file:
TWITCH_CLIENT_ID=your-client-id
TWITCH_CLIENT_SECRET=your-client-secret
You can also publish the configuration file to customize the package settings:
php artisan vendor:publish --tag=twitch-config
If you would like to contribute to the package, please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Write tests for your changes.
- Run the tests to ensure they pass.
- Submit a pull request with a clear description of your changes.
If you find any issues or have any questions, feel free to open an issue on GitHub.