Skip to content

fix: SolapiMessageService에서 커스텀 PSR-18 HTTP 클라이언트 주입이 불가능하던 문제 수정#24

Merged
Palbahngmiyine merged 1 commit intosolapi:masterfrom
KnifeLemon:master
Feb 23, 2026
Merged

fix: SolapiMessageService에서 커스텀 PSR-18 HTTP 클라이언트 주입이 불가능하던 문제 수정#24
Palbahngmiyine merged 1 commit intosolapi:masterfrom
KnifeLemon:master

Conversation

@KnifeLemon
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @KnifeLemon, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 풀 리퀘스트는 SolapiMessageService에서 사용자 정의 PSR-18 HTTP 클라이언트를 사용할 수 있도록 하여 서비스의 유연성을 향상시킵니다. 기존에는 내부적으로 고정된 HTTP 클라이언트 구현을 사용했지만, 이제 외부에서 ClientInterface를 구현한 클라이언트를 주입할 수 있게 되어, 개발자가 원하는 HTTP 클라이언트를 선택하거나 테스트 환경에서 모의 객체를 쉽게 사용할 수 있게 됩니다.

Highlights

  • PSR-18 HTTP 클라이언트 주입: SolapiMessageService 생성자에 선택적 PSR-18 ClientInterface 타입의 HTTP 클라이언트 주입 기능이 추가되었습니다.
  • Fetcher 인스턴스 초기화: 주입된 HTTP 클라이언트 인스턴스는 Fetcher::getInstance 메서드로 전달되어 Fetcher가 해당 클라이언트를 사용하도록 변경되었습니다.
Changelog
  • src/Services/SolapiMessageService.php
    • Psr\Http\Client\ClientInterface 네임스페이스가 추가되었습니다.
    • SolapiMessageService 클래스의 생성자에 ClientInterface 타입의 선택적 $httpClient 매개변수가 추가되었습니다.
    • Fetcher::getInstance 메서드 호출 시 새로 추가된 $httpClient 매개변수가 전달되도록 수정되었습니다.
Activity
  • 풀 리퀘스트가 생성되었습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

SolapiMessageService에서 PSR-18 HTTP 클라이언트를 주입할 수 있도록 개선한 점은 좋습니다. 다만, 내부적으로 사용하는 Fetcher 클래스가 싱글톤 패턴으로 구현되어 있어, 여러 서비스 인스턴스를 생성할 때 설정이 공유되는 부작용이 발생할 수 있습니다. 이를 해결하기 위해 싱글톤 대신 직접 인스턴스를 생성하는 방식을 권장합니다.

@Palbahngmiyine
Copy link
Member

안녕하세요 @KnifeLemon 님, 솔라피 기술지원팀입니다. 올리신 PR 기여에 대해서는 감사드리나, 해당 PR을 올리시게 된 상황등을 설명란에 명시해주시기 바라겠습니다.

@KnifeLemon
Copy link
Contributor Author

안녕하세요 @KnifeLemon 님, 솔라피 기술지원팀입니다. 올리신 PR 기여에 대해서는 감사드리나, 해당 PR을 올리시게 된 상황등을 설명란에 명시해주시기 바라겠습니다.

안녕하세요.
기존에 solapi-php 구버전을 사용하다가 composer update를 통해 최신 버전으로 업데이트하게 되었습니다.

업데이트 이후 지속적으로 오류가 발생하였고, 출시노트(https://github.com/orgs/solapi/discussions/125)를 통해 allow_url_fopen 설정이 On 상태여야 한다는 점을 확인했습니다.

하지만 제가 사용 중인 호스팅 환경(닷홈)의 경우 allow_url_fopen 설정 변경이 어려운 상황이었습니다.

이에 따라 Guzzle 클라이언트를 직접 주입하는 방식으로 해결하고자 했습니다.
src/Libraries/Fetcher.php에는 Guzzle 주입을 위한 매개변수가 존재하지만, src/Services/SolapiMessageService.php에서는 이를 외부에서 전달할 수 있는 구조가 아니어서 실질적으로 주입이 어려운 상태였습니다.

따라서 SolapiMessageService에서도 Custom Http Cient를 주입할 수 있도록 생성자 매개변수를 확장하였습니다.

물론 사용자 측에서 override를 통해 해결할 수도 있겠지만, 해당 패키지를 사용하는 입장에서 보면 직접 override를 구현해야 하는 구조보다는, 공식적으로 주입을 지원하는 편이 더 친절한 설계라고 생각하여 PR을 작성하게 되었습니다.

해당 변경은 기존 사용 방식과의 하위 호환성을 유지하면서 확장성을 제공하는 방향으로 작성하였습니다.

검토 부탁드립니다. 감사합니다.

@Palbahngmiyine
Copy link
Member

@KnifeLemon 님, 말씀 해 주신 사항 확인 했습니다, 해당 건의 경우 본래 의도라면 기여 코드와 같이 메시지 서비스에서 주입해주어야 하나, 테스트 부족으로 해당 사항이 빠진 것 같습니다. 기여해주신 코드는 큰 문제는 없는 것으로 보여 머지 하겠습니다.

다만 실제 릴리즈는 이번 주 내로 5.1.2 버전으로 진행될 예정인 점 참고 부탁드리겠습니다.
기여에 감사드립니다.

@Palbahngmiyine Palbahngmiyine merged commit 4be7a94 into solapi:master Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants