Skip to content

Commit

Permalink
add voice messages
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiez committed Oct 4, 2021
1 parent c30fce4 commit 115dc7d
Show file tree
Hide file tree
Showing 31 changed files with 625 additions and 333 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
![Sms77 Logo](https://www.sms77.io/wp-content/uploads/2019/07/sms77-Logo-400x79.png "Sms77 Logo")

# Official Sylius Plugin for Sms77.io
Programmatically send SMS by subscribing to Sylius events.<br>
Send out Bulk SMS to all of your customers at once.<br>
Supports sending SMS and making text-to-speech calls.
Programmatically send messages by subscribing to Sylius events.<br>
Send out bulk messages to all of your customers at once.<br>
Make it even easier for your customers to get informed about order updates and shop related information.

## Installation
Expand Down Expand Up @@ -32,8 +33,10 @@ Make it even easier for your customers to get informed about order updates and s
6. Navigate to Sms77->Configurations and create your first configuration.

### Screenshots
![Write Message](screenshots/write_sms.png "Write Message")
![Message Overview](screenshots/messages.png "Message Overview")
![Write SMS](screenshots/write_sms.png "Write SMS")
![Write Voice](screenshots/write_voice.png "Write Voice")
![Sent SMS](screenshots/sms.png "Sent SMS")
![Sent Voice](screenshots/voice.png "Sent Voice")
![Create Configuration](screenshots/config_edit.png "Create Configuration")
![Configuration Overview](screenshots/config_list.png "Configuration Overview")

Expand Down
113 changes: 62 additions & 51 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,68 +6,79 @@
"role": "Developer"
}
],
"support": {
"email": "[email protected]",
"docs": "https://github.com/sms77io/sylius",
"rss": "https://www.sms77.io/de/feed/",
"source": "https://github.com/sms77io/sylius"
"autoload": {
"psr-4": {
"Sms77\\SyliusPlugin\\": "src/"
}
},
"config": {
"sort-packages": true
},
"conflict": {
"symfony/symfony": "4.1.8",
"symfony/browser-kit": "4.1.8",
"symfony/dependency-injection": "4.1.8",
"symfony/dom-crawler": "4.1.8",
"symfony/routing": "4.1.8"
},
"description": "sms77.io plugin for Sylius applications.",
"extra": {
"branch-alias": {
"dev-master": "1.10-dev"
}
},
"name": "sms77/sylius-plugin",
"type": "sylius-plugin",
"keywords": [
"marketing",
"sms",
"sylius"
"sylius",
"sylius-plugin",
"text-to-speech",
"voice"
],
"description": "Sms77.io API plugin for Sylius.",
"license": "MIT",
"minimum-stability": "dev",
"name": "sms77/sylius-plugin",
"prefer-stable": true,
"require": {
"php": "7.2 - 8.0",
"sylius/sylius": "^1.6",
"sms77/api": "v2.5.0"
"php": "^7.4 || ^8.0",
"sms77/api": "v2.5.0",
"sylius/sylius": "~1.9.0 || ~1.10.0@beta"
},
"require-dev": {
"behat/behat": "^3.4",
"behat/mink": "^1.7@dev",
"behat/mink-browserkit-driver": "^1.3",
"behat/mink-extension": "^2.2",
"behat/mink-selenium2-driver": "^1.3",
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-debug-extension": "^2.0.0",
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.0",
"friends-of-behat/variadic-extension": "^1.1",
"lakion/mink-debug-extension": "^1.2.3",
"phpspec/phpspec": "^5.0",
"phpstan/phpstan-doctrine": "^0.10",
"phpstan/phpstan-shim": "^0.10",
"phpstan/phpstan-webmozart-assert": "^0.10",
"phpunit/phpunit": "^6.5",
"sensiolabs/security-checker": "^5.0",
"sylius-labs/coding-standard": "^2.0",
"symfony/browser-kit": "^3.4|^4.1",
"symfony/debug-bundle": "^3.4|^4.1",
"symfony/dotenv": "^4.2",
"symfony/intl": "^3.4|^4.1",
"symfony/web-profiler-bundle": "^3.4|^4.1",
"symfony/web-server-bundle": "^3.4|^4.1"
},
"conflict": {
"symfony/symfony": "4.1.8",
"symfony/browser-kit": "4.1.8",
"symfony/dependency-injection": "4.1.8",
"symfony/dom-crawler": "4.1.8",
"symfony/routing": "4.1.8"
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.85",
"phpstan/phpstan-doctrine": "0.12.33",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.2",
"symfony/debug-bundle": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
"symfony/intl": "^4.4 || ^5.2",
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
"vimeo/psalm": "4.7.1"
},
"prefer-stable": true,
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"Sms77\\SyliusPlugin\\": "src/"
}
"support": {
"docs": "https://github.com/sms77io/sylius",
"email": "[email protected]",
"rss": "https://www.sms77.io/de/feed/",
"source": "https://github.com/sms77io/sylius"
},
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
}
}
"type": "sylius-plugin"
}
13 changes: 13 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');

$containerConfigurator->parameters()->set(Option::SKIP, [
VisibilityRequiredFixer::class => ['*Spec.php'],
]);
};
14 changes: 14 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
parameters:
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false

excludes_analyse:
# Makes PHPStan crash
- 'src/DependencyInjection/Configuration.php'

# Test dependencies
- 'tests/Application/app/**.php'
- 'tests/Application/src/**.php'

ignoreErrors:
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
15 changes: 15 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
</psalm>
Binary file removed screenshots/messages.png
Binary file not shown.
Binary file added screenshots/sms.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/voice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/write_voice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 12 additions & 16 deletions src/Api/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use Sms77\SyliusPlugin\Entity\Config;
use Sms77\SyliusPlugin\Repository\ConfigRepository;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\OrderShippingStates;
use Sylius\Component\Core\Model\ShipmentInterface;
use Sylius\Component\Core\OrderShippingStates;

class Client {
/* @var Config $configuration */
Expand All @@ -30,33 +30,32 @@ public function sms($data): void {

$client = $this->initApi();

if (null === $to || null === $client) {
return;
}
if (null === $to || null === $client) return;

$params = $this->configuration->getSmsParams()
->setText($text)
->setTo($to);

$client->sms($to, $text, $this->configuration->getApiParams());
$client->sms($params);
}

private function orderToPhone(OrderInterface $order): ?string {
$shippingAddress = $order->getShippingAddress();
$billingAddress = $order->getBillingAddress();

if (null !== $shippingAddress && null !== $shippingAddress->getPhoneNumber()) {
if (null !== $shippingAddress && null !== $shippingAddress->getPhoneNumber())
return $shippingAddress->getPhoneNumber();
}

if (null !== $billingAddress && null !== $billingAddress->getPhoneNumber()) {
if (null !== $billingAddress && null !== $billingAddress->getPhoneNumber())
return $billingAddress->getPhoneNumber();
}

return null;
}

private function stateToText(string $state): ?string {
if (null !== $this->configuration
&& OrderShippingStates::STATE_SHIPPED === $state) {
&& OrderShippingStates::STATE_SHIPPED === $state)
return $this->configuration->getShippingText();
}

return null;
}
Expand All @@ -67,12 +66,9 @@ private function initApi(): ?ApiClient {
if (null !== $this->configuration) {
$apiKey = $this->configuration->getApiKey();

if (isset($apiKey)) {
$client = new ApiClient(
$this->configuration->getApiKey(), 'sylius');
}
if (isset($apiKey)) $client = new ApiClient($apiKey, 'sylius');
}

return $client;
}
}
}
Loading

0 comments on commit 115dc7d

Please sign in to comment.