Skip to content

Commit 54701f9

Browse files
committed
Add Symfony bundle, tests and update domain structure
1 parent 030b56d commit 54701f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+5250
-611
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
vendor
22
build
3+
var/cache
4+
var/logs
5+
var/sessions

.scrutinizer.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
filter:
2+
excluded_paths: [tests/*]
3+
4+
checks:
5+
php:
6+
remove_extra_empty_lines: true
7+
remove_php_closing_tag: true
8+
remove_trailing_whitespace: true
9+
fix_use_statements:
10+
remove_unused: true
11+
preserve_multiple: false
12+
preserve_blanklines: true
13+
order_alphabetically: true
14+
fix_php_opening_tag: true
15+
fix_linefeed: true
16+
fix_line_ending: true
17+
fix_identation_4spaces: true
18+
fix_doc_comments: true
19+
20+
tools:
21+
external_code_coverage:
22+
timeout: 600
23+
runs: 1

.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: php
2+
php:
3+
- '7.0'
4+
- '7.1'
5+
- nightly
6+
7+
before_script:
8+
- composer install -o
9+
10+
after_script:
11+
- |
12+
if [ $TRAVIS_PHP_VERSION = '7.0' ]; then
13+
travis_retry wget https://scrutinizer-ci.com/ocular.phar
14+
php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
15+
fi
16+
17+
install:
18+
- export PATH="$HOME/.composer/vendor/bin:$PATH"
19+
- travis_retry composer self-update && composer --version
20+
21+
services:
22+
- redis-server
23+
- rabbit
24+
25+
script: phpunit --configuration phpunit.xml

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2017, Dmytro Dzubenko
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# What is webhooks?
2+
3+
[![Build Status][ico-travis]][link-travis]
4+
[![Quality Score][ico-code-quality]][link-code-quality]
5+
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
6+
[![Latest Version on Packagist][ico-version]][link-packagist]
7+
[![Total Downloads][ico-downloads]][link-downloads]
8+
[![Software License][ico-license]](LICENSE.md)
9+
10+
This component provides ability to send webhooks to 3-rd party service with retry strategies.
11+
12+
## Frameworks support
13+
14+
This package provides in-build Symfony bundle.
15+
16+
17+
## Motivation & Benefits
18+
19+
* allow to send webhooks to 3-rd party services
20+
* increase probability of webhooks delivery, collect logs
21+
22+
## Installation
23+
```
24+
composer require dzubchik/webhooks
25+
```
26+
27+
## License
28+
29+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
30+
31+
[ico-version]: https://img.shields.io/packagist/v/dzubchik/webhooks.svg?style=flat-square
32+
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
33+
[ico-travis]: https://img.shields.io/travis/dzubchik/webhooks/master.svg?style=flat-square
34+
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/dzubchik/webhooks.svg?style=flat-square
35+
[ico-code-quality]: https://img.shields.io/scrutinizer/g/dzubchik/webhooks.svg?style=flat-square
36+
[ico-downloads]: https://img.shields.io/packagist/dt/dzubchik/webhooks.svg?style=flat-square
37+
38+
[link-packagist]: https://packagist.org/packages/paymaxi/circuit-breaker
39+
[link-travis]: https://travis-ci.org/dzubchik/webhooks
40+
[link-scrutinizer]: https://scrutinizer-ci.com/g/dzubchik/webhooks/code-structure
41+
[link-code-quality]: https://scrutinizer-ci.com/g/dzubchik/webhooks
42+
[link-downloads]: https://packagist.org/packages/dzubchik/webhooks
43+
[link-author]: https://github.com/dzubchik
44+
[link-contributors]: ../../contributors

app/AppCache.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
4+
5+
class AppCache extends HttpCache
6+
{
7+
}

app/AppKernel.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
use Skrz\Bundle\BunnyBundle\SkrzBunnyBundle;
4+
use Symfony\Component\HttpKernel\Kernel;
5+
use Symfony\Component\Config\Loader\LoaderInterface;
6+
7+
class AppKernel extends Kernel
8+
{
9+
public function registerBundles()
10+
{
11+
$bundles = [
12+
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
13+
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
14+
new Symfony\Bundle\TwigBundle\TwigBundle(),
15+
new Symfony\Bundle\MonologBundle\MonologBundle(),
16+
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
17+
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
18+
new Webhook\Bundle\WebhookBundle(),
19+
];
20+
21+
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
22+
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
23+
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
24+
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
25+
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
26+
}
27+
28+
return $bundles;
29+
}
30+
31+
public function getCacheDir()
32+
{
33+
return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
34+
}
35+
36+
public function getLogDir()
37+
{
38+
return dirname(__DIR__) . '/var/logs';
39+
}
40+
41+
public function registerContainerConfiguration(LoaderInterface $loader)
42+
{
43+
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
44+
}
45+
46+
public function getRootDir()
47+
{
48+
return __DIR__;
49+
}
50+
}

app/autoload.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
use Doctrine\Common\Annotations\AnnotationRegistry;
4+
use Composer\Autoload\ClassLoader;
5+
6+
/** @var ClassLoader $loader */
7+
$loader = require __DIR__.'/../vendor/autoload.php';
8+
9+
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
10+
11+
return $loader;

app/config/config.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
imports:
2+
- { resource: parameters.yml }
3+
- { resource: security.yml }
4+
- { resource: services.yml }
5+
6+
# Put parameters here that don't need to change on each machine where the app is deployed
7+
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
8+
parameters:
9+
locale: en
10+
11+
framework:
12+
#esi: ~
13+
#translator: { fallbacks: ['%locale%'] }
14+
secret: '%secret%'
15+
router:
16+
resource: '%kernel.root_dir%/config/routing.yml'
17+
strict_requirements: ~
18+
form: ~
19+
csrf_protection: ~
20+
validation: { enable_annotations: true }
21+
# serializer: { enable_annotations: true }
22+
templating:
23+
engines: ['twig']
24+
default_locale: '%locale%'
25+
trusted_hosts: ~
26+
trusted_proxies: ~
27+
session:
28+
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
29+
handler_id: session.handler.native_file
30+
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
31+
fragments: ~
32+
http_method_override: true
33+
assets: ~
34+
php_errors:
35+
log: true
36+
37+
# Twig Configuration
38+
twig:
39+
debug: '%kernel.debug%'
40+
strict_variables: '%kernel.debug%'
41+
42+
# Doctrine Configuration
43+
doctrine:
44+
dbal:
45+
driver: pdo_pgsql
46+
host: '%database_host%'
47+
port: '%database_port%'
48+
dbname: '%database_name%'
49+
user: '%database_user%'
50+
password: '%database_password%'
51+
charset: UTF8
52+
# if using pdo_sqlite as your database driver:
53+
# 1. add the path in parameters.yml
54+
# e.g. database_path: "%kernel.root_dir%/../var/data/data.sqlite"
55+
# 2. Uncomment database_path in parameters.yml.dist
56+
# 3. Uncomment next line:
57+
#path: '%database_path%'
58+
59+
orm:
60+
auto_generate_proxy_classes: '%kernel.debug%'
61+
naming_strategy: doctrine.orm.naming_strategy.underscore
62+
auto_mapping: true

app/config/config_dev.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
imports:
2+
- { resource: config.yml }
3+
4+
framework:
5+
router:
6+
resource: '%kernel.root_dir%/config/routing_dev.yml'
7+
strict_requirements: true
8+
9+
monolog:
10+
handlers:
11+
main:
12+
type: stream
13+
path: '%kernel.logs_dir%/%kernel.environment%.log'
14+
level: debug
15+
channels: ['!event']
16+
console:
17+
type: console
18+
channels: ['!event', '!doctrine']
19+
# uncomment to get logging in your browser
20+
# you may have to allow bigger header sizes in your Web server configuration
21+
#firephp:
22+
# type: firephp
23+
# level: info
24+
#chromephp:
25+
# type: chromephp
26+
# level: info
27+
28+
#swiftmailer:
29+
# delivery_addresses: ['[email protected]']

0 commit comments

Comments
 (0)