Skip to content

Infraspeak/pie-composer-parser-service

Repository files navigation

Composer Parser Service

PIE Intro

This is a service that belongs to a bigger project (PIE). PIE's objective is to return all issues from repositories present on a composer.json or a package.json file. The idea came in Hactoberfest 2020, when the team wanted to contribute to the packages we are using, but there was no easy way to list them all. PIE project is composed by 5 projects:

Resume

This service is connected to a Redis channel, listening for messages that contain the content of composer.json files. It will then parse those contents and inject into a different Redis channel all repositories found.

Project Setup

The following commands assume you have .direnv installed and authorized. Check how to do it here

docker build -t infraspeak-pie/composer-parser-service-composer -f .docker/composer/Dockerfile .docker/composer/
composer install
cp .env.example .env

Project Run

php artisan redis:queue

How it works

This service is connected to a Redis channel listening for messages with a specific topic (defaults to COMPOSER_FILE). Those messages contain a UUID and the content of a composer.json file ex:

{
   "headers": {
      // uuid identifier
   },
   "payload": {
      // composer.json file content
   }
}

Upon receiving a message, the service will list all repositories present on the composer.json file and broadcast a message into another channel with the repository information. This new channel depends on the package hosting location and will have the form of REPO_<DOMAIN> ex: REPO_github.com, REPO_GITLAB.COM.

{
   "headers": {
      // uuid identifier
   },
   "payload": {
      "name": , //package name
      "version": , // package version
      "url": // package url
   }
}