A type-safe REST client for PHP that generates API implementations from annotated interfaces.
Retrofit PHP is a type-safe REST client library for PHP, inspired by Square's Retrofit for Java. It allows developers to define REST API endpoints using annotated PHP interfaces, which automatically generate implementations to handle HTTP requests and responses, promoting clean separation of API definitions from networking logic and reducing boilerplate code.
PHP developers building REST API clients who prioritize type safety, maintainability, and a declarative approach, particularly those familiar with or inspired by Square's Retrofit pattern in Java.
Developers choose Retrofit PHP for its interface-based, annotation-driven API definitions that ensure type safety and reduce runtime errors, along with flexible integration with HTTP clients like Guzzle and pluggable converters for serialization, offering both synchronous and asynchronous execution modes.
Retrofit implementation in PHP. A REST client for PHP.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Ensures correct typing of request parameters and response bodies through annotated interfaces, reducing runtime errors as highlighted in the type safety feature.
Uses PHP annotations to define REST endpoints in interfaces, promoting clean separation of concerns and improved code readability, as shown in the GitHubService example.
Works with external HTTP clients like Guzzle 6 via adapter libraries, allowing developers to choose their preferred networking implementation without being locked in.
Supports converters such as Gson for automatic serialization and deserialization, simplifying data transformation without manual parsing, as noted in the converter system feature.
Does not ship with a built-in HTTP client or converters; requires separate installations like Guzzle 6 adapter and Gson converter, adding complexity to setup.
Version 3 introduces many breaking changes, necessitating careful migration and review of upgrade guides, which can disrupt existing projects.
The annotation-based interface setup and multiple library integrations can be overkill for basic API calls, adding unnecessary boilerplate compared to direct HTTP client usage.