Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: OxCom/symfony-rollbar-bundle
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: rollbar/rollbar-php-symfony-bundle
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on Oct 18, 2017

  1. Rename the package

    ArturMoczulski authored Oct 18, 2017
    Copy the full SHA
    3b5302c View commit details
  2. Copy the full SHA
    fc233e9 View commit details
  3. Copy the full SHA
    4ab2cfb View commit details

Commits on Apr 11, 2018

  1. Copy the full SHA
    0d378c7 View commit details
  2. Copy the full SHA
    28a42da View commit details
  3. Copy the full SHA
    22a26b5 View commit details
  4. Copy the full SHA
    006f955 View commit details
  5. Copy the full SHA
    59a0dac View commit details
  6. Copy the full SHA
    a2ea0ed View commit details
  7. Copy the full SHA
    c21ec1a View commit details

Commits on Apr 12, 2018

  1. Improve readme

    ArturMoczulski committed Apr 12, 2018
    Copy the full SHA
    8b63b7b View commit details
  2. Copy the full SHA
    36a2b50 View commit details
  3. composer fix

    ArturMoczulski committed Apr 12, 2018
    Copy the full SHA
    f235668 View commit details
  4. Copy the full SHA
    bbfb72f View commit details
  5. Copy the full SHA
    0a4d5ff View commit details

Commits on Apr 14, 2018

  1. Copy the full SHA
    6213a6e View commit details
  2. #9: fir intending

    ArturMoczulski committed Apr 14, 2018
    Copy the full SHA
    983817b View commit details
  3. Copy the full SHA
    e09ad1d View commit details
  4. Copy the full SHA
    a8093df View commit details
  5. Copy the full SHA
    27392f1 View commit details
  6. Copy the full SHA
    943eea4 View commit details
  7. Copy the full SHA
    ff74c15 View commit details
  8. github-9: composer fix

    ArturMoczulski committed Apr 14, 2018
    Copy the full SHA
    f45f7fc View commit details
  9. Copy the full SHA
    30ddf72 View commit details

Commits on Apr 15, 2018

  1. Copy the full SHA
    b33394e View commit details

Commits on Apr 16, 2018

  1. Copy the full SHA
    a45250c View commit details
  2. Copy the full SHA
    f41d913 View commit details
  3. Copy the full SHA
    05bac3b View commit details
  4. Copy the full SHA
    d8afc38 View commit details
  5. Copy the full SHA
    9be4c7c View commit details
  6. Copy the full SHA
    d3846a7 View commit details
  7. Merge pull request #12 from rollbar/symfony-bundle-standards

    Ground up refactor
    ArturMoczulski authored Apr 16, 2018
    Copy the full SHA
    81ed53d View commit details
  8. Fix a readme typo

    ArturMoczulski committed Apr 16, 2018
    Copy the full SHA
    12c86d6 View commit details
  9. Copy the full SHA
    e4aea09 View commit details
  10. Copy the full SHA
    81fbed1 View commit details
  11. Copy the full SHA
    bf6b68e View commit details

Commits on Apr 17, 2018

  1. Copy the full SHA
    b9a1d6a View commit details
  2. Copy the full SHA
    042442a View commit details
  3. Copy the full SHA
    ad23d27 View commit details
  4. Copy the full SHA
    214b97f View commit details
  5. Copy the full SHA
    2fdc141 View commit details
  6. Copy the full SHA
    3530545 View commit details
  7. Copy the full SHA
    28947e4 View commit details
  8. Copy the full SHA
    6be0284 View commit details
  9. Copy the full SHA
    30ee295 View commit details
  10. Copy the full SHA
    daca2d6 View commit details
  11. Copy the full SHA
    99862d7 View commit details
  12. Copy the full SHA
    39a35bc View commit details
  13. Copy the full SHA
    c7e45a3 View commit details
  14. Copy the full SHA
    198d0ef View commit details
Showing with 921 additions and 1,595 deletions.
  1. +34 −0 .github/pull_request_template.md
  2. +44 −0 .github/workflows/code_checks.yaml
  3. +2 −0 .gitignore
  4. +0 −18 .travis.yml
  5. +66 −0 CHANGELOG.md
  6. +58 −0 DependencyInjection/Configuration.php
  7. +8 −20 src/DependencyInjection/SymfonyRollbarExtension.php → DependencyInjection/RollbarExtension.php
  8. +49 −0 Factories/RollbarHandlerFactory.php
  9. +9 −23 {src → }/Payload/ErrorItem.php
  10. +123 −0 Payload/Generator.php
  11. +19 −0 Payload/TraceChain.php
  12. +14 −18 {src → }/Payload/TraceItem.php
  13. +65 −36 README.md
  14. +14 −0 Resources/config/services.yml
  15. +103 −0 Resources/doc/index.rst
  16. +9 −0 RollbarBundle.php
  17. +42 −0 Tests/DependencyInjection/ConfigurationTest.php
  18. +53 −0 Tests/DependencyInjection/RollbarExtensionTest.php
  19. +44 −0 Tests/Fixtures/App/AppKernel.php
  20. +3 −2 {tests/Fixtures/app → Tests/Fixtures/App}/config/config.yml
  21. +18 −0 Tests/Fixtures/App/config/config_test.yml
  22. 0 {tests/Fixtures/app → Tests/Fixtures/App}/config/parameters.yml
  23. 0 {tests → Tests}/Fixtures/fatal.php
  24. +17 −22 {tests/SymfonyRollbarBundle → Tests}/Payload/ErrorItemTest.php
  25. +55 −95 {tests/SymfonyRollbarBundle → Tests}/Payload/GeneratorTest.php
  26. +5 −8 {tests/SymfonyRollbarBundle → Tests}/Payload/TraceChainTest.php
  27. +8 −12 {tests/SymfonyRollbarBundle → Tests}/Payload/TraceItemTest.php
  28. +31 −18 composer.json
  29. +28 −0 phpunit.xml
  30. +0 −78 src/DependencyInjection/Configuration.php
  31. +0 −86 src/EventListener/AbstractListener.php
  32. +0 −105 src/EventListener/ErrorListener.php
  33. +0 −52 src/EventListener/ExceptionListener.php
  34. +0 −163 src/Payload/Generator.php
  35. +0 −24 src/Payload/TraceChain.php
  36. +0 −40 src/Provider/RollbarHandler.php
  37. +0 −26 src/Resources/config/services.yml
  38. +0 −13 src/SymfonyRollbarBundle.php
  39. +0 −55 tests/Fixtures/ErrorHandler.php
  40. +0 −46 tests/Fixtures/app/AppKernel.php
  41. +0 −11 tests/Fixtures/app/autoload.php
  42. +0 −9 tests/Fixtures/app/config/config_test.yml
  43. +0 −43 tests/SymfonyRollbarBundle/BundleTest.php
  44. +0 −59 tests/SymfonyRollbarBundle/DependencyInjection/ConfigurationTest.php
  45. +0 −72 tests/SymfonyRollbarBundle/DependencyInjection/SymfonyRollbarExtensionTest.php
  46. +0 −128 tests/SymfonyRollbarBundle/EventListener/AbstractListenerTest.php
  47. +0 −206 tests/SymfonyRollbarBundle/EventListener/ErrorListenerTest.php
  48. +0 −43 tests/SymfonyRollbarBundle/EventListener/ExceptionListenerTest.php
  49. +0 −30 tests/SymfonyRollbarBundle/Provider/RollbarHandlerTest.php
  50. +0 −34 tests/phpunit.xml
34 changes: 34 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Description of the change

> Please include a summary of the change and which issues are fixed.
> Please also include relevant motivation and context.
## Type of change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Maintenance
- [ ] New release

## Related issues

> Shortcut stories and GitHub issues (delete irrelevant)
- Fix [SC-]
- Fix #1

## Checklists

### Development

- [ ] Lint rules pass locally
- [ ] The code changed/added as part of this pull request has been covered with tests
- [ ] All tests related to the changed code pass in development

### Code review

- [ ] This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
- [ ] "Ready for review" label attached to the PR and reviewers assigned
- [ ] Issue from task tracker has a link to this pull request
- [ ] Changes have been reviewed by at least one other engineer
44 changes: 44 additions & 0 deletions .github/workflows/code_checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# .github/workflows/code_checks.yaml
name: Code_Checks

on: ["push", "pull_request"]

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- php: '8.0'
stability: 'prefer-lowest'
- php: '8.0'
stability: 'prefer-stable'
- php: '8.1'
stability: 'prefer-stable'
- php: '8.2'
stability: 'prefer-stable'

name: PHP ${{ matrix.php }} - ${{ matrix.stability }} tests
steps:
# basically git clone
- uses: actions/checkout@v3

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

# use PHP of specific version
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: pcov, dom, curl, libxml, mbstring
coverage: pcov

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@
/vendor/
/var/
!/var/.gitkeep
.phpunit.result.cache
.phpunit.cache

composer.lock
clover.xml
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

66 changes: 66 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Changelog

## [v5.1.0] - 2023-05-05
* Added tests for PHP 8.2 and updated CI workflow by symfony 6.2.10 @Chris53897 in #84
* Added support for `rollbar/rollbar` v4 by @Chris53897 in #86
* Added Symfony framework and version to configs by @danielmorell in #88

## [v5.0.0] - 2022-09-16
* Added Symfony 6 support, and update tests by @art-cg in #73
* Added GitHub actions by @art-cg in #74
* Feature/remove unused language version by @Chris53897 in #77
* Fixed failing CI by @danielmorell in #78
* Fixed #51 To make catch statement broader by @danielmorell in #80
* Added CHANGELOG.md by @danielmorell in #81

## [v4.0.0] - 2020-02-15
* Update to symfony5 #61

## [v3.1.2] - 2019-01-02
* #39 Person data not loaded TokenStorage as documented

## [v3.1.1] - 2018-12-16
* #38: phpunit exits with a non-zero status
* Update README.md

## [v3.1.0] - 2018-10-16
* #34 Change the name of the report to rollbar-php-symfony-bundle
* #24 Point docs from README to Rollbar's site
* #37 Remove exception listeners, rely on Symfony...::logKernelException() to log uncaught exceptions
* readme updates

## [v3.0.0] - 2018-10-10
* Update README.md by @jessewgibbs in #30
* Add Symfony 4 support and ability to configure all Rollbar parameters by @javer in #27

## [v2.0.0] - 2018-04-17
* Major refactoring of the directory structure following Symfony's [best practices](http://symfony.com/doc/3.4/bundles/best_practices.html).
* Updated the `rollbar/rollbar` dependency to use the latest release.
* Added support for manual logging through the `LoggerInterface` injected logger.
* Utilized Symfony's Monolog Bundle to tap into Symfony's common logging mechanism.
* Updated `README.md` and `Resources/doc/index.rst`.
* Added Symfony's logged in user tracking by default.
* Added support for `person_fn` for modifying the user tracking data.
* Refactored the configuration options structure for `app/config/config.yml`.
* Added passing Rollbar's default config values as they are defined in `rollbar/rollbar` dependency instead of redefining them in the bundle.

## [v1.0.2] - 2018-02-16
* update: allow to work with php7

## [v1.0.1] - 2017-08-09
* Update ExceptionListener.php fix function access level

## [v1.0.0] - 2017-05-08
* coverage


[v5.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v4.0.0...v5.0.0
[v4.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.1.2...v4.0.0
[v3.1.2]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.1.1...v3.1.2
[v3.1.1]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.1.0...v3.1.1
[v3.1.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.0.0...v3.1.0
[v3.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v2.0.0...v3.0.0
[v2.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v1.0.2...v2.0.0
[v1.0.2]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v1.0.1...v1.0.2
[v1.0.1]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v1.0.0...v1.0.1
[v1.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/releases/tag/v1.0.0
58 changes: 58 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace Rollbar\Symfony\RollbarBundle\DependencyInjection;

use Rollbar\Config;
use Rollbar\Defaults;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* Class Configuration
*
* @link https://rollbar.com/docs/notifier/rollbar-php/#configuration-reference
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder(RollbarExtension::ALIAS);
$rollbarConfigNode = $treeBuilder->getRootNode();

$rollbarConfigNodeChildren = $rollbarConfigNode->children();

$configOptions = Config::listOptions();
$rollbarDefaults = Defaults::get();

foreach ($configOptions as $option) {
$method = match ($option) {
'branch' => 'gitBranch',
default => $option,
};

try {
$default = $rollbarDefaults->fromSnakeCase($method);
} catch (\Exception $e) {
$default = null;
}

if (is_array($default)) {
$rollbarConfigNodeChildren
->arrayNode($option)
->scalarPrototype()->end()
->defaultValue($default)
->end();
} else {
$rollbarConfigNodeChildren
->scalarNode($option)
->defaultValue($default)
->end();
}
}

return $treeBuilder;
}
}
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
<?php

namespace SymfonyRollbarBundle\DependencyInjection;
namespace Rollbar\Symfony\RollbarBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* Class Extension
* @package SymfonyRollbarBundle\DependencyInjection
*/
class SymfonyRollbarExtension extends Extension
class RollbarExtension extends Extension
{
const ALIAS = 'symfony_rollbar';
public const ALIAS = 'rollbar';

/**
* Loads a specific configuration.
*
* @param array $configs An array of configuration values
* @param ContainerBuilder $container A ContainerBuilder instance
*
* @throws \InvalidArgumentException When provided tag is not defined in this extension
* {@inheritdoc}
* @throws \Exception
*/
public function load(array $configs, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container): void
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);

if (!$config['enable']) {
return;
}

// load services and register listeners
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
@@ -41,9 +29,9 @@ public function load(array $configs, ContainerBuilder $container)
}

/**
* @return string
* {@inheritdoc}
*/
public function getAlias()
public function getAlias(): string
{
return static::ALIAS;
}
49 changes: 49 additions & 0 deletions Factories/RollbarHandlerFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace Rollbar\Symfony\RollbarBundle\Factories;

use Psr\Log\LogLevel;
use Monolog\Handler\RollbarHandler;
use Rollbar\Rollbar;
use Rollbar\Symfony\RollbarBundle\DependencyInjection\RollbarExtension;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Kernel;

class RollbarHandlerFactory
{
public function __construct(ContainerInterface $container)
{
$config = $container->getParameter(RollbarExtension::ALIAS . '.config');

if (isset($_ENV['ROLLBAR_TEST_TOKEN']) && $_ENV['ROLLBAR_TEST_TOKEN']) {
$config['access_token'] = $_ENV['ROLLBAR_TEST_TOKEN'];
}

if (!empty($config['person_fn']) && is_callable($config['person_fn'])) {
$config['person'] = null;
} elseif (empty($config['person'])) {
$config['person_fn'] = static function () use ($container) {
try {
$token = $container->get('security.token_storage')->getToken();

if ($token) {
$user = $token->getUser();
$serializer = $container->get('serializer');
return \json_decode($serializer->serialize($user, 'json'), true, 512, JSON_THROW_ON_ERROR);
}
} catch (\Throwable $exception) {
// Ignore
}
};
}

$config['framework'] = 'symfony ' . Kernel::VERSION;

Rollbar::init($config, false, false, false);
}

public function createRollbarHandler(): RollbarHandler
{
return new RollbarHandler(Rollbar::logger(), LogLevel::ERROR);
}
}
Loading