Skip to content

Commit

Permalink
Add SentryHandler (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
B-Galati authored Aug 17, 2019
1 parent acf546c commit 715f8bb
Show file tree
Hide file tree
Showing 13 changed files with 960 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
end_of_line = LF
insert_final_newline = true
charset = utf-8
indent_size = 4
indent_style = space
trim_trailing_whitespace = true

[*.{yml,yaml}]
indent_size = 2

[Makefile]
indent_style = tab
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
Makefile export-ignore
README.md export-ignore
tests/ export-ignore
.php_cs.dist export-ignore
.phpstan.neon.dist export-ignore
doc/ export-ignore
.php_cs.dist export-ignore
.editorconfig export-ignore
CHANGELOG.md export-ignore
CONTRIBUTING.md export-ignore
phpunit.xml.dist export-ignore
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/composer.lock
/vendor/
.php_cs.cache
.phpunit.result.cache
70 changes: 70 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->append([__FILE__])
;

return PhpCsFixer\Config::create()
->setRules([
'@DoctrineAnnotation' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'@PHPUnit60Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'void_return' => false, // Enforce by @PHP71Migration:risky but can break method definition for libraries
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'],
'array_indentation' => true,
'braces' => ['allow_single_line_closure' => true],
'compact_nullable_typehint' => true,
'no_extra_blank_lines' => [
'tokens' => [
'break',
'continue',
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'throw',
'use',
],
],
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => [
'importsOrder' => [
'class',
'function',
'const',
],
'sortAlgorithm' => 'alpha',
],
'php_unit_method_casing' => [
'case' => 'camel_case',
],
'phpdoc_order' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'strict_comparison' => true,
'strict_param' => true,
'phpdoc_summary' => false,
'no_unneeded_final_method' => false,
'no_superfluous_phpdoc_tags' => true,
'concat_space' => ['spacing' => 'none'],
'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'],
'phpdoc_to_comment' => false,
'native_constant_invocation' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized']],
'array_syntax' => ['syntax' => 'short'],
'declare_strict_types' => true,
'no_whitespace_before_comma_in_array' => false,
'binary_operator_spaces' => ['default' => 'align'],
'self_accessor' => false,
])
->setRiskyAllowed(true)
->setFinder($finder)
;
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
language: php
dist: bionic
sudo: false

env:
global:
- COMPOSER_INSTALL_FLAGS="--no-interaction --no-progress --prefer-dist"
- COMPOSER_UPDATE_FLAGS="--no-interaction --no-progress --prefer-dist"

matrix:
fast_finish: true
include:
- php: 7.1
env: COMPOSER_UPDATE_FLAGS="--prefer-lowest ${COMPOSER_UPDATE_FLAGS}"
- php: 7.2
- php: 7.3

cache:
directories:
- ${HOME}/.composer/cache

before_install:
- phpenv config-rm xdebug.ini || true

before_script:
- composer self-update

script:
- stty cols 120
- make tests-ci
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/B-Galati/monolog-sentry-handler/compare/v1.0.0...HEAD)

## [1.0.0](https://github.com/B-Galati/monolog-sentry-handler/compare/acf546c...v1.0.0) - 2019-08-17
### Added
- First version of `SentryHandler`
Empty file added CONTRIBUTING.md
Empty file.
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
COMPOSER_INSTALL_FLAGS ?=
COMPOSER_UPDATE_FLAGS ?=

.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'

vendor: composer.lock composer.json ## install composer deps
composer install $(COMPOSER_INSTALL_FLAGS)
@touch $@
composer.lock:
composer update $(COMPOSER_UPDATE_FLAGS)
@touch $@

.PHONY: tests-ci tests
tests-ci: composer-validate phpstan cs-check phpunit
tests: tests-ci cs-check

.PHONY: composer-validate
composer-validate: vendor composer.json composer.lock ## Validate composer.json file
composer validate

.PHONY: phpstan
phpstan: vendor ## Check PHP code style
vendor/bin/phpstan analyse -l7 -- src tests

.PHONY: phpunit
phpunit: vendor ## Run PhpUnit tests
vendor/bin/phpunit -v --testdox

.PHONY: php-cs-fixer-check
cs-check: vendor ## Check php code style
vendor/bin/php-cs-fixer fix --diff --dry-run --no-interaction -v --cache-file=.php_cs.cache --stop-on-violation

.PHONY: vendor cs-fix
cs-fix: ## Automatically php code style
vendor/bin/php-cs-fixer fix -v --cache-file=.php_cs.cache
39 changes: 39 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "bgalati/sentry-handler",
"description": "Sentry handler for php SDK",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Benoit Galati",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"BGalati\\MonologSentryHandler\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"BGalati\\MonologSentryHandler\\Tests\\": "tests"
}
},
"config": {
"sort-packages": true
},
"require": {
"php": "^7.1.3",
"monolog/monolog": "^1.6",
"sentry/sentry": "^2.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.15",
"jangregor/phpstan-prophecy": "^0.4.2",
"phpstan/phpstan": "^0.11.13",
"phpstan/phpstan-phpunit": "^0.11.2",
"phpunit/phpunit": "^7.5||^8.3",
"sentry/sdk": "^2.0",
"symfony/var-dumper": ">4.3"
}
}
7 changes: 7 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/jangregor/phpstan-prophecy/src/extension.neon
parameters:
inferPrivatePropertyTypeFromConstructor: true
tipsOfTheDay: false
22 changes: 22 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
Loading

0 comments on commit 715f8bb

Please sign in to comment.