Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.
/ SinchBundle Public archive
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ language: php
sudo: false

php:
- 7.1
- 7.2
- 7.3
- 7.4
- 7.4
- 8.0

env:
- SYMFONY_VERSION=4.0.*
- SYMFONY_VERSION=4.1.*
- SYMFONY_VERSION=4.2.*
- SYMFONY_VERSION=4.4.*
- SYMFONY_VERSION=4.3.*
- SYMFONY_VERSION=4.4.*

before_install:
- composer self-update
Expand All @@ -25,6 +21,7 @@ install:
script:
- ./vendor/bin/phpcs ./ -p --encoding=utf-8 --extensions=php --ignore="vendor|Tests" --standard=./vendor/escapestudios/symfony2-coding-standard/Symfony
- ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=coverage.xml
- ./vendor/bin/phpstan analyse -l 8 --no-progress -c phpstan.neon ./

after_success:
- bash <(curl -s https://codecov.io/bash)
Expand Down
4 changes: 1 addition & 3 deletions Controller/SinchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace Fresh\SinchBundle\Controller;

use Fresh\SinchBundle\Event\SinchEvents;
use Fresh\SinchBundle\Event\SmsMessageCallbackEvent;
use Fresh\SinchBundle\Form\Type\CallbackRequestType;
use Fresh\SinchBundle\Model\CallbackRequest;
Expand Down Expand Up @@ -57,8 +56,7 @@ public function callbackAction(Request $request): Response
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$event = new SmsMessageCallbackEvent($callbackRequest);
$this->eventDispatcher->dispatch(SinchEvents::CALLBACK_RECEIVED, $event);
$this->eventDispatcher->dispatch(new SmsMessageCallbackEvent($callbackRequest));
} else {
return new Response('Bad Request', Response::HTTP_BAD_REQUEST);
}
Expand Down
14 changes: 9 additions & 5 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@

namespace Fresh\SinchBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* Configuration.
*
* @author Artem Henvald <genvaldartem@gmail.com>
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class Configuration implements ConfigurationInterface
{
Expand All @@ -27,16 +28,19 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('fresh_sinch');
$treeBuilder = new TreeBuilder('fresh_sinch');

$rootNode
/** @var ArrayNodeDefinition $root */
$root = $treeBuilder->getRootNode();

$root
->children()
->scalarNode('host')->defaultValue('https://messagingapi.sinch.com')->end()
->scalarNode('key')->end()
->scalarNode('secret')->end()
->scalarNode('from')->defaultNull()->end()
->end();
->end()
;

return $treeBuilder;
}
Expand Down
6 changes: 2 additions & 4 deletions Event/SmsEvent.php → Event/AbstractBaseSmsEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@

namespace Fresh\SinchBundle\Event;

use Symfony\Component\EventDispatcher\Event;

/**
* SmsEvent.
* AbstractBaseSmsEvent.
*
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class SmsEvent extends Event
abstract class AbstractBaseSmsEvent
{
/** @var string */
private $number;
Expand Down
22 changes: 22 additions & 0 deletions Event/PostSmsSendEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Fresh\SinchBundle\Event;

/**
* PostSmsSendEvent.
*
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class PostSmsSendEvent extends AbstractBaseSmsEvent
{
}
22 changes: 22 additions & 0 deletions Event/PreSmsSendEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Fresh\SinchBundle\Event;

/**
* PreSmsSendEvent.
*
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class PreSmsSendEvent extends AbstractBaseSmsEvent
{
}
42 changes: 0 additions & 42 deletions Event/SinchEvents.php

This file was deleted.

3 changes: 1 addition & 2 deletions Event/SmsMessageCallbackEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@

use Fresh\SinchBundle\Model\CallbackRequest;
use Fresh\SinchBundle\Model\Identity;
use Symfony\Component\EventDispatcher\Event;

/**
* SmsMessageCallbackEvent.
*
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class SmsMessageCallbackEvent extends Event
class SmsMessageCallbackEvent
{
/** @var CallbackRequest */
private $callbackRequest;
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@
[![StyleCI](https://styleci.io/repos/44092074/shield?style=flat-square)](https://styleci.io/repos/44092074)
[![Gitter](https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg?style=flat-square)](https://gitter.im/fre5h/SinchBundle)

[![SensioLabsInsight](https://insight.sensiolabs.com/projects/2303fcfb-2e4b-45b3-8b37-6d1e7598acf4/small.png)](https://insight.sensiolabs.com/projects/2303fcfb-2e4b-45b3-8b37-6d1e7598acf4)
[![knpbundles.com](http://knpbundles.com/fre5h/SinchBundle/badge-short)](http://knpbundles.com/fre5h/SinchBundle)

## Requirements

* PHP 7.1 *and later*
* Symfony 4.0 *and later*
* PHP 7.3 *and later*
* Symfony 4.3 *and later*

## Installation

Expand Down
3 changes: 3 additions & 0 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ services:

Fresh\SinchBundle\Service\Sinch:
class: Fresh\SinchBundle\Service\Sinch

Symfony\Contracts\HttpClient\HttpClientInterface:
factory: ['Symfony\Component\HttpClient\HttpClient', 'create']
Binary file modified Resources/images/sinch-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 0 additions & 39 deletions Service/HTTPClientInterface.php

This file was deleted.

37 changes: 0 additions & 37 deletions Service/HTTPClientService.php

This file was deleted.

Loading