Skip to content

Commit c756600

Browse files
committed
Merge branch 'main' into fix/prevent-json-encoding-crashes
2 parents 3660995 + 5c1b769 commit c756600

81 files changed

Lines changed: 2645 additions & 577 deletions

File tree

Some content is hidden

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

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Feature Request
4+
url: https://github.com/spatie/flare-client-php/discussions/new?category=ideas
5+
about: Share ideas for new features
6+
- name: Ask a Question
7+
url: https://github.com/spatie/flare-client-php/discussions/new?category=q-a
8+
about: Ask the community for help

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
strategy:
1010
matrix:
11-
php: [8.4, 8.3, 8.2]
11+
php: [8.5, 8.4, 8.3, 8.2]
1212
dependency-version: [prefer-lowest, prefer-stable]
1313
os: [ubuntu-latest]
1414

CHANGELOG.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,84 @@
22

33
All notable changes to `flare-client-php` will be documented in this file
44

5+
## 2.5.2 - 2025-11-18
6+
7+
- Allow body field censoring using dot and wildcard syntax
8+
- Fix an issue where the default of the git attribute provider was not provided
9+
10+
## 2.5.1 - 2025-11-13
11+
12+
- Fix an issue where the disabled Flare infrastructure wasn't working propertly
13+
14+
**Full Changelog**: https://github.com/spatie/flare-client-php/compare/2.5.0...2.5.1
15+
16+
## 2.5.0 - 2025-11-07
17+
18+
- Add support for better trace context recording
19+
20+
## 2.4.0 - 2025-11-06
21+
22+
- Update the Git Collector to be more performant
23+
24+
## 2.3.3 - 2025-11-05
25+
26+
- Use local data to determine the telemetry sdk version
27+
28+
## 3.3.3 - 2025-11-05
29+
30+
- Use local data to determine the flare client telemetry version
31+
32+
## 2.3.2 - 2025-10-13
33+
34+
- Fix attribute key for span type in FilesystemRecorder.php
35+
36+
## 2.3.1 - 2025-10-10
37+
38+
- Better handling of success codes in the Api
39+
40+
## 2.3.0 - 2025-10-08
41+
42+
- Fixed an issue where disabled tracing could still trace
43+
- Completely refactored the recorders, the old traits are now deprecated in favour of specific classes for spans or span events
44+
- Fix an issue where attributes of spans & span events used in an error removed the span type
45+
46+
## 2.2.3 - 2025-10-06
47+
48+
- Fix sampler
49+
50+
## 2.2.2 - 2025-09-11
51+
52+
- Fix missing interface parameter
53+
54+
**Full Changelog**: https://github.com/spatie/flare-client-php/compare/2.2.0...2.2.2
55+
56+
## 2.2.0 - 2025-09-11
57+
58+
### What's Changed
59+
60+
* Add additional methods to control custom context
61+
62+
**Full Changelog**: https://github.com/spatie/flare-client-php/compare/2.1.0...2.2.0
63+
64+
## 2.1.0 - 2025-08-27
65+
66+
- Add support for stacktraces with logs
67+
68+
## 2.0.9 - 2025-08-25
69+
70+
- Laravel's `artisan` is now considered a vendor file in stacktraces
71+
- Statamic's `please` is now considered a vendor file in stacktraces
72+
73+
**Full Changelog**: https://github.com/spatie/flare-client-php/compare/2.0.8...2.0.9
74+
75+
## 2.0.8 - 2025-08-21
76+
77+
### What's Changed
78+
79+
* Fix issue where dns servers were contacted by @rubenvanassche in https://github.com/spatie/flare-client-php/pull/44
80+
81+
**Full Changelog**: https://github.com/spatie/flare-client-php/compare/2.0.7...2.0.8
82+
583
## 2.0.7 - 2025-07-17
684

785
- Add support for Curl Options

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Send PHP errors to Flare
1+
# Send PHP errors and traces to Flare
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/flare-client-php.svg?style=flat-square)](https://packagist.org/packages/spatie/flare-client-php)
44
[![Run tests](https://github.com/spatie/flare-client-php/actions/workflows/run-tests.yml/badge.svg)](https://github.com/spatie/flare-client-php/actions/workflows/run-tests.yml)
@@ -11,7 +11,7 @@ Using Laravel? You probably want to use [Flare for Laravel](https://github.com/s
1111

1212
## Documentation
1313

14-
You can find the documentation of this package at [the docs of Flare](https://flareapp.io/docs/flare/general/welcome-to-flare).
14+
You can find the documentation of this package at [the docs of Flare](https://flareapp.io/docs/php/general/introduction).
1515

1616
## Changelog
1717

composer.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
"ext-curl": "*",
1515
"guzzlehttp/guzzle": "^7.9",
1616
"psr/container": "^2.0",
17-
"spatie/backtrace": "^1.6.2",
17+
"spatie/backtrace": "^1.8.0",
1818
"spatie/error-solutions": "^2.0",
1919
"symfony/http-foundation": "^5.2|^6.0|^7.0",
2020
"symfony/mime": "^5.2|^6.0|^7.0",
2121
"symfony/process": "^5.2|^6.0|^7.0",
2222
"symfony/var-dumper": "^5.2|^6.0|^7.0"
2323
},
2424
"require-dev": {
25-
"pestphp/pest": "^2.36.0",
25+
"pestphp/pest": "^2.36.0|^3.0|^4.0",
2626
"phpstan/extension-installer": "^1.4",
2727
"phpstan/phpstan-deprecation-rules": "^1.2",
2828
"phpstan/phpstan-phpunit": "^1.4",
@@ -31,10 +31,7 @@
3131
"autoload": {
3232
"psr-4": {
3333
"Spatie\\FlareClient\\": "src"
34-
},
35-
"files": [
36-
"src/helpers.php"
37-
]
34+
}
3835
},
3936
"autoload-dev": {
4037
"psr-4": {

phpstan-baseline.neon

Lines changed: 7 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -85,145 +85,35 @@ parameters:
8585
count: 1
8686
path: src/FlareConfig.php
8787

88-
-
89-
message: "#^Instanceof between \\*NEVER\\* and Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent will always evaluate to false\\.$#"
90-
count: 1
91-
path: src/Recorders/ApplicationRecorder/ApplicationRecorder.php
92-
93-
-
94-
message: "#^Match arm is unreachable because previous comparison is always true\\.$#"
95-
count: 1
96-
path: src/Recorders/ApplicationRecorder/ApplicationRecorder.php
97-
98-
-
99-
message: "#^Instanceof between Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent and Spatie\\\\FlareClient\\\\Spans\\\\Span will always evaluate to false\\.$#"
100-
count: 1
101-
path: src/Recorders/CacheRecorder/CacheRecorder.php
102-
103-
-
104-
message: "#^Instanceof between \\*NEVER\\* and Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent will always evaluate to false\\.$#"
105-
count: 1
106-
path: src/Recorders/CommandRecorder/CommandRecorder.php
107-
108-
-
109-
message: "#^Match arm is unreachable because previous comparison is always true\\.$#"
110-
count: 1
111-
path: src/Recorders/CommandRecorder/CommandRecorder.php
112-
113-
-
114-
message: "#^Instanceof between Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent and Spatie\\\\FlareClient\\\\Spans\\\\Span will always evaluate to false\\.$#"
115-
count: 1
116-
path: src/Recorders/DumpRecorder/DumpRecorder.php
117-
118-
-
119-
message: "#^Instanceof between Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent and Spatie\\\\FlareClient\\\\Spans\\\\Span will always evaluate to false\\.$#"
120-
count: 1
121-
path: src/Recorders/ErrorRecorder/ErrorRecorder.php
122-
123-
-
124-
message: "#^Instanceof between \\*NEVER\\* and Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent will always evaluate to false\\.$#"
125-
count: 1
126-
path: src/Recorders/ExternalHttpRecorder/ExternalHttpRecorder.php
127-
128-
-
129-
message: "#^Match arm is unreachable because previous comparison is always true\\.$#"
130-
count: 1
131-
path: src/Recorders/ExternalHttpRecorder/ExternalHttpRecorder.php
132-
13388
-
13489
message: "#^Class Spatie\\\\FlareClient\\\\Recorders\\\\ExternalHttpRecorder\\\\Guzzle\\\\FlareHandlerStack extends @final class GuzzleHttp\\\\HandlerStack\\.$#"
13590
count: 1
13691
path: src/Recorders/ExternalHttpRecorder/Guzzle/FlareHandlerStack.php
13792

138-
-
139-
message: "#^Instanceof between \\*NEVER\\* and Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent will always evaluate to false\\.$#"
140-
count: 1
141-
path: src/Recorders/FilesystemRecorder/FilesystemRecorder.php
142-
143-
-
144-
message: "#^Match arm is unreachable because previous comparison is always true\\.$#"
145-
count: 1
146-
path: src/Recorders/FilesystemRecorder/FilesystemRecorder.php
147-
148-
-
149-
message: "#^Instanceof between Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent and Spatie\\\\FlareClient\\\\Spans\\\\Span will always evaluate to false\\.$#"
150-
count: 1
151-
path: src/Recorders/GlowRecorder/GlowRecorder.php
152-
15393
-
15494
message: "#^Instanceof between Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent and Spatie\\\\FlareClient\\\\Spans\\\\Span will always evaluate to false\\.$#"
15595
count: 1
156-
path: src/Recorders/LogRecorder/LogRecorder.php
157-
158-
-
159-
message: "#^Instanceof between \\*NEVER\\* and Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent will always evaluate to false\\.$#"
160-
count: 1
161-
path: src/Recorders/QueryRecorder/QueryRecorder.php
162-
163-
-
164-
message: "#^Match arm is unreachable because previous comparison is always true\\.$#"
165-
count: 1
166-
path: src/Recorders/QueryRecorder/QueryRecorder.php
167-
168-
-
169-
message: "#^Instanceof between \\*NEVER\\* and Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent will always evaluate to false\\.$#"
170-
count: 1
171-
path: src/Recorders/RedisCommandRecorder/RedisCommandRecorder.php
172-
173-
-
174-
message: "#^Match arm is unreachable because previous comparison is always true\\.$#"
175-
count: 1
176-
path: src/Recorders/RedisCommandRecorder/RedisCommandRecorder.php
177-
178-
-
179-
message: "#^Instanceof between \\*NEVER\\* and Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent will always evaluate to false\\.$#"
180-
count: 1
181-
path: src/Recorders/RequestRecorder/RequestRecorder.php
182-
183-
-
184-
message: "#^Match arm is unreachable because previous comparison is always true\\.$#"
185-
count: 1
186-
path: src/Recorders/RequestRecorder/RequestRecorder.php
187-
188-
-
189-
message: "#^Instanceof between \\*NEVER\\* and Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent will always evaluate to false\\.$#"
190-
count: 1
191-
path: src/Recorders/ResponseRecorder/ResponseRecorder.php
192-
193-
-
194-
message: "#^Match arm is unreachable because previous comparison is always true\\.$#"
195-
count: 1
196-
path: src/Recorders/ResponseRecorder/ResponseRecorder.php
96+
path: src/Recorders/SpanEventsRecorder.php
19797

19898
-
199-
message: "#^Instanceof between \\*NEVER\\* and Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent will always evaluate to false\\.$#"
200-
count: 1
201-
path: src/Recorders/RoutingRecorder/RoutingRecorder.php
202-
203-
-
204-
message: "#^Match arm is unreachable because previous comparison is always true\\.$#"
99+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
205100
count: 1
206-
path: src/Recorders/RoutingRecorder/RoutingRecorder.php
101+
path: src/Recorders/SpanEventsRecorder.php
207102

208103
-
209104
message: "#^Instanceof between \\*NEVER\\* and Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent will always evaluate to false\\.$#"
210105
count: 1
211-
path: src/Recorders/TransactionRecorder/TransactionRecorder.php
106+
path: src/Recorders/SpansRecorder.php
212107

213108
-
214109
message: "#^Match arm is unreachable because previous comparison is always true\\.$#"
215110
count: 1
216-
path: src/Recorders/TransactionRecorder/TransactionRecorder.php
111+
path: src/Recorders/SpansRecorder.php
217112

218113
-
219-
message: "#^Instanceof between \\*NEVER\\* and Spatie\\\\FlareClient\\\\Spans\\\\SpanEvent will always evaluate to false\\.$#"
220-
count: 1
221-
path: src/Recorders/ViewRecorder/ViewRecorder.php
222-
223-
-
224-
message: "#^Match arm is unreachable because previous comparison is always true\\.$#"
114+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
225115
count: 1
226-
path: src/Recorders/ViewRecorder/ViewRecorder.php
116+
path: src/Recorders/SpansRecorder.php
227117

228118
-
229119
message: "#^Access to an undefined property Spatie\\\\FlareClient\\\\Contracts\\\\FlareSpanType\\:\\:\\$value\\.$#"

shared/FakeSender.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Spatie\FlareClient\Tests\Shared;
44

55
use Closure;
6+
use Spatie\FlareClient\Enums\FlarePayloadType;
67
use Spatie\FlareClient\Senders\Sender;
78
use Spatie\FlareClient\Senders\Support\Response;
89

@@ -25,6 +26,7 @@ public function post(
2526
string $endpoint,
2627
string $apiToken,
2728
array $payload,
29+
FlarePayloadType $type,
2830
Closure $callback
2931
): void {
3032
self::$requests[] = [

shared/FakeTime.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ public static function setCurrentTime(string|DateTimeImmutable $dateTime): void
5252
static::$dateTime = $dateTime;
5353
}
5454

55+
public static function advance(int $seconds): void
56+
{
57+
if (static::isSetup() === false) {
58+
throw new \Exception('FakeTime is not setup. Call FakeTime::setup() first.');
59+
}
60+
61+
static::$dateTime = static::$dateTime->add(new \DateInterval("PT{$seconds}S"));
62+
}
63+
5564
public static function reset()
5665
{
5766
static::$instance = null;

shared/Samplers/TestSampler.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace Spatie\FlareClient\Tests\Shared\Samplers;
4+
5+
use Spatie\FlareClient\Sampling\RateSampler;
6+
use Spatie\FlareClient\Sampling\Sampler;
7+
8+
class TestSampler implements Sampler
9+
{
10+
public static float $sampleRate;
11+
12+
public static function alwaysSample(): void
13+
{
14+
static::$sampleRate = 1;
15+
}
16+
17+
public static function neverSample(): void
18+
{
19+
static::$sampleRate = 0;
20+
}
21+
22+
public static function sampleRate(float $sampleRate): void
23+
{
24+
static::$sampleRate = $sampleRate;
25+
}
26+
27+
public function shouldSample(array $context): bool
28+
{
29+
return (new RateSampler(['rate' => static::$sampleRate]))->shouldSample($context);
30+
}
31+
}

0 commit comments

Comments
 (0)