Skip to content

Conversation

@omarabdelaz1z
Copy link

@omarabdelaz1z omarabdelaz1z commented Mar 19, 2025

Why

This PR supports the Brandencode SMS provider to expand Resala's capabilities. The changes include configuration updates and driver (API) implementation (see: https://sms.brandencode.com/api/documentation)

What

  1. Configuration Updates:
  • Added brandencode configuration options to config/resala.php for endpoint, username, password, sender name, and language settings.
<?php
....
'drivers' => [ 
        ...,
        'brandencode' => [
            'end_point' => env('BRANDENCODE_END_POINT'),
            'username' => env('BRANDENCODE_USERNAME'),
            'password' => env('BRANDENCODE_PASSWORD'),
            'sender_name' => env('BRANDENCODE_SENDER_NAME', 'Brandencode'),
            'lang' => env('BRANDENCODE_LANG', 'E')
        ],
]
  • Added a new stub file to include base env variables in the .env file.
  • Updated the publish command to utilize the new stub file.
  1. Driver Implementation:
  • A new BrandEncodeDriver class implements SMSDriverInterface.
  • Implemented methods to set recipients, message, and send SMS requests to the BrandEncode API with Response handling BrandEncodeResponse implementing SMSDriverResponseInterface

How

  • The BrandEncodeDriver was implemented as a concrete class of the existing Driver abstract class, adhering to the SMSDriverInterface. This ensures consistency with the design pattern of other drivers in the project.
  • The BrandEncodeResponse class was developed to parse and evaluate the response from the Brandencode API, ensuring compliance with the expected response structure.
  • The configuration file (config/resala.php) was updated to include the necessary settings for Brandencode, while default values and environment variable placeholders were added for flexibility.
  • The PublishProviderEnvVariablesCommand was extended to generate the stub file for Brandencode, making it easier for developers to set up and configure the driver.

@ahmadalfy
Copy link
Member

Omar, can you fix those linting errors so we can get rid of them once and for all?

@ahmadalfy
Copy link
Member

Also, can your PR include a proper description of what was done, why and how you did it 😀
@omarabdelaz1z

@omarabdelaz1z
Copy link
Author

Omar, can you fix those linting errors so we can get rid of them once and for all?

I cannot find the list of linting errors returned from the CI so I ran it locally and resolved all of them in the PSR1 / PSR2 and PSR12 standards.

@omarabdelaz1z omarabdelaz1z changed the title Feat: Introduce BrandEncode SMS Provider Add support for Brandencode SMS Driver Apr 10, 2025
@omarabdelaz1z
Copy link
Author

Also, can your PR include a proper description of what was done, why and how you did it 😀 @omarabdelaz1z

Updated it now.

@ahmadalfy ahmadalfy merged commit c0faae1 into RobustaStudio:master Apr 10, 2025
1 check failed
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.

3 participants