This project is a Twitch API developed in PHP
using the Laravel
framework and Docker
for containerization. It adheres to Clean Code principles, includes comprehensive testing, and incorporates regular code refactoring to maintain high code quality. The API provides the following endpoints:
curl -X GET 'http://localhost/analytics/streamers?id=459331509'
curl -X GET 'http://localhost/analytics/streams'
/topsofthetops:since (
GET
): Retrieves data for the top 40 videos of each of the top three most popular games, with an optional integer parametersince
to filter results based on time (seconds).curl -X GET 'http://localhost/analytics/topsofthetops'
curl -X GET 'http://localhost/analytics/topsofthetops?since=150'
curl -X GET 'http://localhost/analytics/timeline?username=user_name'
curl -X POST 'http://localhost/analytics/follow' \ -H "Content-Type: application/json" \ -d '{"username": "user_name", "streamerId": "streamer_id"}'curl -X DELETE 'http://localhost/analytics/unfollow' \ -H "Content-Type: application/json" \ -d '{"username": "user_name", "streamerId": "streamer_id"}'curl -X POST 'http://localhost/analytics/users' \ -H "Content-Type: application/json" \ -d '{"username": "user_name", "password": "password"}'curl -X GET 'http://localhost/analytics/users'
git clone git@github.com:sayechu/laravel-twitch-api.git
cd laravel-twitch-api
composer install
cp .env.example .env
Note I: alias sail='sh $([ -f sail ] && echo sail || echo vendor/bin/sail)'
Note II: run Docker Desktop before executing this command
sail up -d
sail php artisan migrate
- To stop the running containers, execute:
sail down
- To run the unitary and integrations tests:
./vendor/bin/phpunit
- To rollback the migrations:
sail php artisan migrate:rollback