82 Commits

Author SHA1 Message Date
Marc
0818f8f8c1 chore: bump go mod (#2297)
closes https://github.com/php/frankenphp/pull/2296
closes https://github.com/php/frankenphp/issues/2295
2026-03-23 19:30:03 +07:00
Kévin Dunglas
ff70f7e02b chore: bump deps 2026-03-10 10:33:03 +01:00
Kévin Dunglas
c2eb7a2538 chore: bump deps 2026-03-06 16:48:09 +01:00
Kévin Dunglas
f434f5ea37 chore: bump deps 2026-02-23 16:46:51 +01:00
Marc
2bdf85866c Upgrade to Cady v2.11.1 (#2214)
fixes failing integration tests and closes
https://github.com/php/frankenphp/issues/2213
2026-02-21 23:29:47 +07:00
Alexandre Daubois
d704e60bb0 chore: bump to Go 1.26 (#2178)
Bump and free perf boost with Green tea GC 🍵
2026-02-11 14:55:57 +01:00
Kévin Dunglas
471c5af2df fix: race condition introduced in 04fdc0c (#2180)
Fix issue introduced in 04fdc0c1e8
2026-02-11 13:07:09 +01:00
Kévin Dunglas
6eef0d30aa chore: bump deps 2026-02-09 14:31:16 +01:00
Kévin Dunglas
709ba29bef chore: bump deps 2026-01-29 16:51:29 +01:00
Kévin Dunglas
e01e40fd97 chore: bump deps (#2078) 2025-12-17 11:47:14 +01:00
Raphael Coeffic
91c553f3d9 feat: add support for structured logging with the frankenphp_log() PHP function (#1979)
As discussed in https://github.com/php/frankenphp/discussions/1961,
there is no real way to pass a severity/level to any log handler offered
by PHP that would make it to the FrankenPHP layer. This new function
allows applications embedding FrankenPHP to integrate PHP logging into
the application itself, thus offering a more streamlined experience.

---------

Co-authored-by: Quentin Burgess <qutn.burgess@gmail.com>
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-12-15 16:10:35 +01:00
Kévin Dunglas
225ca409d3 feat: hot reload (#2031)
This patch brings hot reloading capabilities to PHP apps: in
development, the browser will automatically refresh the page when any
source file changes!
It's similar to HMR in JavaScript.

It is built on top of [the watcher
mechanism](https://frankenphp.dev/docs/config/#watching-for-file-changes)
and of the [Mercure](https://frankenphp.dev/docs/mercure/) integration.

Each time a watched file is modified, a Mercure update is sent, giving
the ability to the client to reload the page, or part of the page
(assets, images...).

Here is an example implementation:

```caddyfile
root ./public


mercure {
      subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY}
      anonymous
}

php_server {
      hot_reload
}
```

```php
<?php
header('Content-Type: text/html');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
<script>
    const es = new EventSource('<?=$_SERVER['FRANKENPHP_HOT_RELOAD']?>');
    es.onmessage = () => location.reload();
</script>
</head>
<body>
Hello
```

I plan to create a helper JS library to handle more advanced cases
(reloading CSS, JS, etc), similar to [HotWire
Spark](https://github.com/hotwired/spark). Be sure to attend my
SymfonyCon to learn more!

There is still room for improvement:

- Provide an option to only trigger the update without reloading the
worker for some files (ex, images, JS, CSS...)
- Support classic mode (currently, only the worker mode is supported)
- Don't reload all workers when only the files used by one change

However, this PR is working as-is and can be merged as a first step.

This patch heavily refactors the watcher module. Maybe it will be
possible to extract it as a standalone library at some point (would be
useful to add a similar feature but not tight to PHP as a Caddy module).

---------

Signed-off-by: Kévin Dunglas <kevin@dunglas.fr>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-12 14:29:18 +01:00
Max
c9ad9fc55a headerKeyCache: use otter v2 (#2040)
Benchmarks show that version 1, while extremely fast with hot keys,
becomes several times slower than no‑cache under frequent misses.
Version 2 delivers consistently better performance across all scenarios,
with no allocations and stable latency.

```
BenchmarkGetUnCommonHeaderNoCacheSequential-12                           7545640               169.4 ns/op            72 B/op          4 allocs/op
BenchmarkGetUnCommonHeaderV2Sequential-12                               14471982                85.98 ns/op            0 B/op          0 allocs/op
BenchmarkGetUnCommonHeaderV1Sequential-12                               19748048                59.63 ns/op            0 B/op          0 allocs/op

BenchmarkGetUnCommonHeaderNoCacheParallelOneKey-12                      24352088                44.47 ns/op           72 B/op          4 allocs/op
BenchmarkGetUnCommonHeaderV2ParallelOneKey-12                           91024160                11.76 ns/op            0 B/op          0 allocs/op
BenchmarkGetUnCommonHeaderV1ParallelOneKey-12                           192048842                6.186 ns/op           0 B/op          0 allocs/op

BenchmarkGetUnCommonHeaderNoCacheParallelRandomMaximumSize-12           26261611                43.07 ns/op           62 B/op          3 allocs/op
BenchmarkGetUnCommonHeaderV2ParallelRandomMaximumSize-12                100000000               14.43 ns/op            0 B/op          0 allocs/op
BenchmarkGetUnCommonHeaderV1ParallelRandomMaximumSize-12                137813384                8.965 ns/op           0 B/op          0 allocs/op

BenchmarkGetUnCommonHeaderNoCacheParallelRandomLenKeys-12               24224664                46.57 ns/op           71 B/op          3 allocs/op
BenchmarkGetUnCommonHeaderV2ParallelRandomLenKeys-12                    69002575                17.42 ns/op            0 B/op          0 allocs/op
BenchmarkGetUnCommonHeaderV1ParallelRandomLenKeys-12                     8498404               253.1 ns/op            42 B/op          1 allocs/op
```

---------

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-12-01 11:37:40 +01:00
Kévin Dunglas
e6b3f70d91 chore: bump deps 2025-11-23 23:13:12 +01:00
Kévin Dunglas
75a48e81a7 chore: bump deps 2025-11-18 11:48:59 +01:00
Kévin Dunglas
41cb2bbeaa feat: mercure_publish() PHP function to dispatch Mercure updates (#1927)
* feat: mercure_publish() PHP function to dispatch Mercure updates

* fix stubs for old versions

* review

* cleanup and fixes
2025-11-18 09:59:53 +01:00
Alexandre Daubois
40cb42aace chore: bump net 2025-11-17 15:09:30 +01:00
Alexandre Daubois
b49aed1934 chore: bump deps 2025-10-31 16:51:26 +01:00
dependabot[bot]
219a5407ff chore: bump the go-modules group with 2 updates (#1903) 2025-09-29 17:56:28 +02:00
Kévin Dunglas
460d63e436 chore: bump deps and check go.mod files are clean in CI 2025-08-28 19:16:01 +02:00
Alexandre Daubois
99bb87167e chore: bump deps 2025-08-27 15:56:40 +02:00
Alexandre Daubois
d7aebedd2d chore: bump golang.org/x/net to v0.43.0 2025-08-18 11:27:19 +02:00
Kévin Dunglas
5f153e06d6 chore: upgrade to Go 1.25 (#1811)
* chore: upgrade to Go 1.25

* free all interned strings (test)

* Revert "free all interned strings (test)"

This reverts commit 34823baadb.

* Another test.

* Another test

* ASAN_OPTIONS: detect_leaks=0

* Update sanitizers.yaml

* Update sanitizers.yaml

* Update sanitizers.yaml

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
2025-08-18 10:46:03 +02:00
Alexandre Daubois
6ad34b1cb3 chore: bump deps 2025-08-14 15:27:29 +02:00
Kévin Dunglas
0c25b2488c chore: bump deps 2025-07-16 13:29:04 +02:00
Kévin Dunglas
80de1f8bc7 chore: bump deps (#1702) 2025-06-30 14:36:26 +02:00
Kévin Dunglas
abfd893d88 feat: FrankenPHP extensions (#1651)
* feat: add helpers to create PHP extensions (#1644)

* feat: add helpers to create PHP extensions

* cs

* feat: GoString

* test

* add test for RegisterExtension

* cs

* optimize includes

* fix

* feat(extensions): add the PHP extension generator (#1649)

* feat(extensions): add the PHP extension generator

* unexport many types

* unexport more symbols

* cleanup some tests

* unexport more symbols

* fix

* revert types files

* revert

* add better validation and fix templates

* remove GoStringCopy

* small fixes

---------

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* try to fix tests

* fix CS

* try some workarounds

* try some workarounds

* ingore TestRegisterExtension

* exclude cgo tests in Docker images

* fix

* workaround...

* race detector

* simplify tests and code

* make linter happy

* feat(gofile): use templates to generate the Go file (#1666)

---------

Co-authored-by: Alexandre Daubois <2144837+alexandre-daubois@users.noreply.github.com>
2025-06-25 10:18:22 +02:00
Kévin Dunglas
12f469e701 chore: bump deps (#1643) 2025-06-19 19:10:59 +02:00
Kévin Dunglas
afa7dafe1c chore: bump deps 2025-05-16 09:22:00 +02:00
Kévin Dunglas
0d12a5162d fix: use local Go toolchain (#1546) 2025-05-11 22:30:19 +02:00
Alexander Stecher
a48db9422d fix: go toolchain versioning (#1545)
* Removes toolchain requirements.

* trigger

* Removes explicit calls to go get

* trigger

* Update static-builder-musl.Dockerfile

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Update static-builder-musl.Dockerfile

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Update static-builder-gnu.Dockerfile

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Update alpine.Dockerfile

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Update Dockerfile

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Update Dockerfile

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Update alpine.Dockerfile

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* trigger

* trigger

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-05-11 09:18:45 +02:00
Indra Gunawan
1ec37f6cc9 feat: replace zap with slog (#1527) 2025-04-26 11:04:46 +02:00
Indra Gunawan
8febee71af chore: update Go and toolchain version (#1526) 2025-04-23 11:02:37 +02:00
Kévin Dunglas
7f8e43fd62 feat: upgrade to Caddy 2.10 2025-04-22 16:15:11 +02:00
Kévin Dunglas
565b3a9629 chore: bump deps (#1455) 2025-03-24 11:56:20 +01:00
Indra Gunawan
87315a19ae feat: introduces worker name option, use label on worker metrics instead (#1376)
* add worker name option and use it in logs and metrics, update tests

* fix missing reference for collector

* update tests

* update docs

* fix conflict

* add missing allowedDirectives

* update tests
2025-03-22 12:32:59 +01:00
Kévin Dunglas
409c0fdf5f chore: bump deps (#1434) 2025-03-10 15:35:17 +01:00
Kévin Dunglas
251567a617 fix: Mercure duplicate metrics panic (#1393)
* fix: Mercure duplicate metrics panic

* tidy

* ci: clang-format
2025-02-19 12:40:59 +01:00
Kévin Dunglas
f61bc180c4 chore: upgrade to Go 1.24 2025-02-18 07:33:36 +01:00
Kévin Dunglas
7bd6ca89b0 chore: bump deps 2025-01-28 11:19:14 +01:00
Kévin Dunglas
19344a0dfe chore: bump deps 2025-01-08 20:54:21 +01:00
Kévin Dunglas
2276129c6d feat(caddy): upgrade to Caddy 2.9.0 2025-01-06 13:34:53 +01:00
Kévin Dunglas
e2687dbeb9 chore: bump deps 2024-12-21 19:05:53 +01:00
Kévin Dunglas
79ab84dad7 chore: bump deps 2024-12-18 17:12:50 +01:00
Kévin Dunglas
2f3e4b650b chore: bump deps (#1235)
* chore: bump deps

* chore: bump indirect deps

* downgrade Brotli
2024-12-10 14:58:26 +01:00
Kévin Dunglas
a1797c49b0 chore: bump deps (#1187) 2024-11-23 13:53:08 +01:00
Kévin Dunglas
172b598f3b chore: bump deps (#1150) 2024-11-11 23:24:42 +01:00
Kévin Dunglas
75dab8f33d chore: bump deps and misc improvements (#1135) 2024-11-04 16:42:15 +01:00
Kévin Dunglas
2532eb5887 chore: compile without nosql's support for Postgres and MySQL (#1112) 2024-10-22 22:50:31 +02:00
Kévin Dunglas
f43de0ccf5 chore: bump deps 2024-10-18 15:47:09 +02:00