Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 Release #11

Merged
merged 4 commits into from
Dec 16, 2024
Merged

V2 Release #11

merged 4 commits into from
Dec 16, 2024

Conversation

Douglasokolaa
Copy link
Owner

@Douglasokolaa Douglasokolaa commented Dec 16, 2024

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.

dependabot bot and others added 4 commits December 10, 2024 14:07
Bumps the composer group with 2 updates: [guzzlehttp/guzzle](https://github.com/guzzle/guzzle) and [guzzlehttp/psr7](https://github.com/guzzle/psr7).


Updates `guzzlehttp/guzzle` from 7.3.0 to 7.4.5
- [Release notes](https://github.com/guzzle/guzzle/releases)
- [Changelog](https://github.com/guzzle/guzzle/blob/7.9/CHANGELOG.md)
- [Commits](guzzle/guzzle@7.3.0...7.4.5)

Updates `guzzlehttp/psr7` from 2.0.0 to 2.7.0
- [Release notes](https://github.com/guzzle/psr7/releases)
- [Changelog](https://github.com/guzzle/psr7/blob/2.7/CHANGELOG.md)
- [Commits](guzzle/psr7@2.0.0...2.7.0)

---
updated-dependencies:
- dependency-name: guzzlehttp/guzzle
  dependency-type: direct:production
  dependency-group: composer
- dependency-name: guzzlehttp/psr7
  dependency-type: indirect
  dependency-group: composer
...

Signed-off-by: dependabot[bot] <support@github.com>
…-1967ddcb51

Bump the composer group with 2 updates
* WIP: Refactor Termii library to a more modular and maintainable architecture

This commit significantly refactors the Termii PHP library by removing outdated files and dependencies. It introduces new resource structures, including MessagingResource, SenderIdResource, and CampaignResource, 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.

Signed-off-by: Douglas Okolaa <okolaadouglas@gmail.com>

* Refactor requests into endpoints

The requests from various parts of the application have been consolidated and refactored into endpoint classes for greater clarity and organization. This change improves maintainability by centralizing request logic, aligning with a more streamlined architecture. Existing requests have been removed or replaced with their endpoint equivalents to ensure consistency across the codebase.

Signed-off-by: Douglas Okolaa <okolaadouglas@gmail.com>

* Refactor and optimize Termii Connector and Resources

The Termii class now uses a singleton pattern for TermiiConnector initialization, simplifying resource management and avoiding redundant connections. In CampaignResource, the phoneBook method is optimized by implementing lazy initialization for PhonebookResource, ensuring efficient resource use.

Signed-off-by: Douglas Okolaa <okolaadouglas@gmail.com>

* docs(README): Enhance library description and usage instructions

* fix: update type declarations and add phpstan

Corrected return types in factory methods to match class names, replaced a dangling static instance with direct instantiation, and removed a debug statement. Additionally, a phpstan configuration file was added to enhance code quality checks, and the phpstan dependency was included in composer.json. These changes aim to improve code reliability and maintainability.

* refactor(endpoints): update endpoints and class properties with test coverage

Modified endpoints in Campaign and adjusted class properties for flexibility. The changes improve data handling, such as making certain fields optional, adding new multipart data structure, and refining API key handling in requests. Updated endpoint paths as part of a broader API alignment effort.

* feat(data): add ConvertsDtoToRequestArray interface implementation

Introduced the `ConvertsDtoToRequestArray` interface and implemented it across relevant DTO classes for enhanced request array conversion. This improves data handling consistency and streamlines request building processes.

* docs(readme): update examples and improve code snippets

Enhanced the README with updated code examples for message sending, campaigns, phonebook, and contact management. Improved clarity by restructuring snippets for better usability and understanding. These changes align with the current TermiiPHP SDK functionality.

* feat(token): implement endpoints for Token API

Added support for generating, sending, and verifying OTPs via voice call, email, in-app, and SMS channels. Introduced relevant resources, endpoints, and tests to ensure functionality and improve API integration. This update enhances the library's utility for handling OTP workflows.

* docs(readme): update examples and improve code snippets

Enhanced the README with updated code examples for message sending, campaigns, phonebook, and contact management. Improved clarity by restructuring snippets for better usability and understanding. These changes align with the current TermiiPHP SDK functionality.

* feat(code-style): introduce PHP-CS-Fixer for consistent formatting

Added `.php-cs-fixer.php` configuration to enforce a consistent code style across the project.
Aligned indentation, spacing, and method declaration formatting using PHP-CS-Fixer rules.

BREAKING CHANGE: Codebase formatting changes can result in merge conflicts or affect existing pull requests.

* feat(debugging): add troubleshooting support

* feat(insight): add Insight API endpoints and related tests

Introduced Insight API endpoints including balance retrieval, phone number status, DND check, and message history. Added corresponding test cases, fixtures, and updated resources for seamless integration.

* feat(core): implement Termii RequestException

Introduce a new custom `RequestException` to replace Saloon's base exceptions. This ensures consistent exception handling across the codebase and improves modularity by centralizing exception management.

* `ci(tests): add GitHub Actions workflow for PHP tests`

* fix(tests): update file path in CampaignApiTest

* feat(ci): add PHP CS fixer workflow for code linting

* fix(workflows): update workflow name to php-cs

* `chore(github): add funding configuration`

---------

Signed-off-by: Douglas Okolaa <okolaadouglas@gmail.com>
@Douglasokolaa Douglasokolaa changed the title Develop V2 Release Dec 16, 2024
@Douglasokolaa Douglasokolaa marked this pull request as ready for review December 16, 2024 08:57
@Douglasokolaa Douglasokolaa merged commit 5af64f4 into master Dec 16, 2024
22 checks passed
@Douglasokolaa Douglasokolaa deleted the develop branch December 16, 2024 09:07
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.

1 participant