{"id":22843238,"url":"https://github.com/jafaripur/php-microservice-application","last_synced_at":"2025-10-22T02:56:24.183Z","repository":{"id":44554025,"uuid":"451423921","full_name":"jafaripur/php-microservice-application","owner":"jafaripur","description":"php-microservice skeleton console application starter for microservice node with Spiral framework.","archived":false,"fork":false,"pushed_at":"2022-08-18T11:07:02.000Z","size":516,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T05:11:31.247Z","etag":null,"topics":["amqp","microservice","php","rabbitmq","roadrunner","spiral"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jafaripur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-24T10:46:42.000Z","updated_at":"2022-03-10T14:43:57.000Z","dependencies_parsed_at":"2022-07-20T20:19:04.163Z","dependency_job_id":null,"html_url":"https://github.com/jafaripur/php-microservice-application","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jafaripur/php-microservice-application","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jafaripur%2Fphp-microservice-application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jafaripur%2Fphp-microservice-application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jafaripur%2Fphp-microservice-application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jafaripur%2Fphp-microservice-application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jafaripur","download_url":"https://codeload.github.com/jafaripur/php-microservice-application/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jafaripur%2Fphp-microservice-application/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280370896,"owners_count":26319317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amqp","microservice","php","rabbitmq","roadrunner","spiral"],"created_at":"2024-12-13T02:13:30.262Z","updated_at":"2025-10-22T02:56:24.168Z","avatar_url":"https://github.com/jafaripur.png","language":"PHP","readme":"# Microservice Application Skeleton\n\n![prod-build](https://github.com/jafaripur/php-microservice-application/actions/workflows/build-prod.yml/badge.svg)\n![test](https://github.com/jafaripur/php-microservice-application/actions/workflows/run-test.yml/badge.svg)\n\n`Spiral` console application used to write our processors of methods to responsible to client calling.\n\n\nThis application a template for microservice application and implement four methods of [jafaripur/php-microservice](https://github.com/jafaripur/php-microservice). Another library created for using this microservice methods [jafaripur/php-microservice-user-service](https://github.com/jafaripur/php-microservice-user-service).\n\nFor consuming and receiving data:\n\n```bash\n\nphp app.php user-service/listen\n\n```\n\nFor sending tests messages, By using this client library (`jafaripur/php-microservice-user-service`):\n\n```bash\n\nphp app.php user-service/send-test\n\n```\n\n## Create project\n\n```bash\n\ncomposer create-project \"jafaripur/php-microservice-application dev-master\" micro3\n\n```\n\n## Production Build\n\nThis application can be run with `roadrunner` service plugin in production with Dockerfile `docker/Dockerfile.prod`, Production build with docker:\n\n```bash\n\nexport DOCKER_BUILDKIT=1 \u0026\u0026 docker build -f \"./docker/Dockerfile.prod\" -t \"micro3-prod:latest\" .\n\n```\n\nAfter building, we can create a container or docker swarm service. The production docker image runs with `RoadRunner`. In this example we use this configuration for [RoadRunner](https://github.com/roadrunner-server/roadrunner), config exist in `.rr.yaml` file.\n\n```yml\n\nversion: \"2.7\"\n\nservice:\n  topics:\n    command: \"php ./app.php user-service/listen first-consumer\"\n    process_num: 10\n    exec_timeout: 0\n    remain_after_exit: true\n    restart_sec: 5\n\n  emits:\n    command: \"php ./app.php user-service/listen second-consumer\"\n    process_num: 2\n    exec_timeout: 0\n    remain_after_exit: true\n    restart_sec: 5\n\nlogs:\n  mode: production\n  encoding: console\n\n```\n\nWith this RoadRunner service plugin we can run several consumer with several instance.\n\nFor creating docker container from builded image:\n\n```bash\n\ndocker run -d --init \\\n    --name micro3-container \\\n    --restart unless-stopped \\\n    micro3-prod:latest\n\n```\n\nAnd for swarm service:\n\n```bash\n\ndocker service create --name \"micro3-service\" \\\n    --replicas 2 \\\n    --update-delay 10s \\\n    micro3-prod:latest\n\n```\n\n## Test\n\n```bash\n\n# Run test\ndocker-compose up --build micro\n\n# Stop and remove created containers\ndocker-compose down\n\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjafaripur%2Fphp-microservice-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjafaripur%2Fphp-microservice-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjafaripur%2Fphp-microservice-application/lists"}