Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Refactor Termii library to a more modular and maintainable architecture Refactor of the Termii PHP library by removing outdated files and dependencies. introduced new resource structures, including Resources, Endpoints, DTO for improved organization and functionality. The Termii class has been updated to integrate these resources, offering a more modular and maintainable architecture for interacting with Termii's API. ### Highlights of Changes in `v2` #### **1. New Features** - **Insight API Support** Added new endpoints for the Insight API, including: - Balance retrieval. - Phone number status check. - DND (Do Not Disturb) checks. - Message history retrieval. Accompanied by corresponding tests and resources for smoother usage. - **Token API for OTP Workflows** Implemented endpoints for generating, sending, and verifying OTPs across multiple channels including: - SMS, voice, email, and in-app. Enhanced with test cases and documentation updates. - **Custom `RequestException` Class** Introduced a new `TermiiRequestException` to replace Saloon's base exceptions. This improves exception handling by centralizing and streamlining error management. - **Troubleshooting Support** Added initial debugging and troubleshooting capabilities to help developers resolve integration issues quickly. #### **2. Codebase Refactoring and Optimization** - Consolidated requests into **Endpoint Classes** for improved clarity and maintainability, aligning with a more modular architecture. - Refactored the `Termii` class to follow the **Singleton Pattern** for managing `TermiiConnector` initialization, reducing redundancy and improving resource handling. - Introduced a new `ConvertsDtoToRequestArray` interface, implemented across relevant DTOs for consistency in request array conversion. #### **3. Coding Standards and Quality** - Applied **PHP-CS-Fixer** for consistent code formatting and adherence to modern standards. - Introduced PHPStan configuration for static analysis, enhancing code quality and reliability. #### **4. Testing Improvements** - Added tests for new APIs and refactored existing test cases, especially around updated resources like `CampaignApiTest`. - Integrated a GitHub Actions workflow for automated testing (`ci(tests)`), ensuring better CI/CD coverage. #### **5. Documentation Updates** - Revised the README to include updated examples of using various APIs (`Messaging`, `Campaigns`, `Phonebook`, `Contact Management`, etc.). - Added instructions for new features and clarified the usage of updated SDK functionalities. ### Breaking Changes - Code restructuring (e.g., endpoint consolidations, new exceptions) will impact downstream projects by requiring updates to match the latest architecture.
- Loading branch information