Kévin Dunglas
57c58faf1c
chore: prepare release 1.11.1
2025-12-20 09:16:23 +01:00
Kévin Dunglas
4092ecb5b5
fix: frankenphp_log() level parameter must be optional
2025-12-19 16:25:32 +01:00
Kévin Dunglas
75ccccf1b2
fix(caddy): use default patterns when hot_reload is alone
2025-12-19 09:38:05 +01:00
Kévin Dunglas
6231bf4a1c
chore: prepare release 1.11.0
2025-12-18 16:51:41 +01:00
Kévin Dunglas
e01e40fd97
chore: bump deps ( #2078 )
2025-12-17 11:47:14 +01:00
dependabot[bot]
3599299cde
chore(caddy): bump github.com/spf13/cobra
...
Bumps the go-modules group in /caddy with 1 update: [github.com/spf13/cobra](https://github.com/spf13/cobra ).
Updates `github.com/spf13/cobra` from 1.10.1 to 1.10.2
- [Release notes](https://github.com/spf13/cobra/releases )
- [Commits](https://github.com/spf13/cobra/compare/v1.10.1...v1.10.2 )
---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
dependency-version: 1.10.2
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: go-modules
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-12-15 13:41:56 +01:00
Alexandre Daubois
41da660088
fix(hot-reload): fix import ( #2069 )
2025-12-12 15:23:55 +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
Kévin Dunglas
4ac024a1d0
fix: remove deprecated Mercure "transport_url" directive from Caddyfile
2025-12-10 15:40:21 +01:00
Kacper Rowiński
e0dcf42852
chore: bump github.com/smallstep/certificates/ from 0.28.4 to 0.29.0
2025-12-09 11:40:58 +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
Alexander Stecher
dadeb5a628
perf: tail latency with goSched ( #2033 )
...
Alternate implementation to #2016 that doesn't reduce RPS with lower
amounts of threads
2025-11-26 18:33:07 +01:00
Kévin Dunglas
fc5f6ef092
chore: prepare release 1.10.1
2025-11-25 10:54:34 +01:00
Kévin Dunglas
6c764ad9c5
fix: correctly set the Mercure hub for the main worker request
2025-11-24 11:21:45 +01:00
Kévin Dunglas
e6b3f70d91
chore: bump deps
2025-11-23 23:13:12 +01:00
Kévin Dunglas
c6cadf3bf6
chore: prepare release 1.10.0
2025-11-21 16:16:01 +01:00
Marc
49e98cc8d6
delete source/downloads after building in script, add .editorconfig ( #2000 )
...
* delete source/downloads after building in script, not in dockerfile
* add editorconfig
* eol
* cs fix
* added \n there
* we expect Hello\n
* Change tab width for shell scripts to 4 spaces
* bring back embed comment
2025-11-20 11:49:09 +01:00
Alexander Stecher
0b2d3c913f
feat: per worker max threads ( #1962 )
...
* adds worker max_threads
* Adds tests for all calculation cases.
* Adds max_threads limitation to test.
* Removes the test sleep.
* Adds max_threads to error message.
* correctly uses continue.
* Fixes logic with only worker max_threads set.
* Adjust comments.
* Removes unnecessary check.
* Fixes comment.
* suggestions by @dunlgas.
* copilot suggestions.
* Renames logger.
* review
---------
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr >
2025-11-18 11:55:29 +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
Kévin Dunglas
8341cc98c6
refactor: rely on context.Context for log/slog and others ( #1969 )
...
* refactor: rely on context.Context for log/slog and others
* optimize
* refactor
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* fix watcher-skip
* better globals handling
* fix
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2025-11-17 16:32:23 +01:00
Alexandre Daubois
40cb42aace
chore: bump net
2025-11-17 15:09:30 +01:00
Kévin Dunglas
724c0b11ca
feat: set a custom Server header
...
# Conflicts:
# caddy/module.go
# frankenphp.go
2025-11-10 17:25:22 +01:00
Kévin Dunglas
6225da9c18
refactor: improve ExtensionWorkers API ( #1952 )
...
* refactor: improve ExtensionWorkers API
* Update workerextension.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* Update workerextension.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* Update caddy/app.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* review
* fix tests
* docs
* errors
* improved error handling
* fix race
* add missing return
* use %q in Errorf
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2025-11-10 14:12:14 +01:00
Marc
264f92835d
bring back logic for workers to inherit php_server parent environment ( #1956 )
...
* bring back logic to inherit php_server parent environment
* change order to account for
php {
worker file.php 1 {
}
}
cases
* suggestion
* add inherit env test
2025-11-02 14:50:50 +01:00
Alexandre Daubois
b49aed1934
chore: bump deps
2025-10-31 16:51:26 +01:00
Alexander Stecher
bf6e6534f6
fix: exit() and dd() support in worker mode ( #1946 )
...
* Verifies exit behavior.
* formatting
* Checks for actual exit.
* Fixes test.
* Fixes test.
* Update testdata/dd.php
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr >
---------
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr >
2025-10-28 10:57:50 +01:00
Kévin Dunglas
f8ea48c3b1
chore(caddy): better error handling
2025-10-15 11:12:34 +02:00
Kévin Dunglas
d52ce94341
docs: improve Mercure documentation and various other parts
2025-10-14 14:32:38 +02:00
Kévin Dunglas
b749f52ae5
chore: simplify string using backticks
...
# Conflicts:
# internal/extgen/classparser.go
# internal/extgen/gofile_test.go
2025-10-14 14:09:17 +02:00
Kévin Dunglas
5514491a18
feat(extgen): support for mixed type ( #1913 )
...
* feat(extgent): support for mixed type
* refactor: use unsafe.Pointer
* Revert "refactor: use unsafe.Pointer"
This reverts commit 8a0b9c1beb .
* fix docs
* fix docs
* cleanup template
* fix template
* fix tests
2025-10-09 14:10:45 +02:00
Alexandre Daubois
7668a27d4b
chore: bump /caddy sub-group deps ( #1863 )
2025-09-23 10:26:13 +02:00
Alexander Stecher
960dd209f7
feat: multiple workers with same file ( #1856 )
...
* Allow multiple workers with the same file.
* Fix formatting of duplicate filename check
* Adds docs.
* suggestions by @alexandre-daubois.
* Update performance.md
---------
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr >
2025-09-09 14:27:00 +02:00
dependabot[bot]
0f942c8601
chore(caddy): bump github.com/spf13/cobra
...
Bumps the go-modules group in /caddy with 1 update: [github.com/spf13/cobra](https://github.com/spf13/cobra ).
Updates `github.com/spf13/cobra` from 1.9.1 to 1.10.0
- [Release notes](https://github.com/spf13/cobra/releases )
- [Commits](https://github.com/spf13/cobra/compare/v1.9.1...v1.10.0 )
---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
dependency-version: 1.10.0
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: go-modules
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-09-01 23:36:48 +02:00
Kévin Dunglas
ad86bf49c2
chore: prepare release 1.9.1
2025-08-28 19:18:41 +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
Alexander Stecher
2b78ffe15c
tests: make caddy_tests faster ( #1823 )
2025-08-25 16:16:32 +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
Alliballibaba
e34b82b425
refactor: removes 'Max Threads'
2025-08-17 21:01:45 +02:00
Kévin Dunglas
a1ae2692e1
chore: modernize Go code
2025-08-15 00:22:44 +02:00
Alexandre Daubois
6ad34b1cb3
chore: bump deps
2025-08-14 15:27:29 +02:00
WeidiDeng
365eae1a99
fix(caddy): check if http app fails to provision due to not configured or invalid configuration ( #1774 )
2025-07-30 11:43:48 +02:00
Kévin Dunglas
50b438f978
chore: prepare release 1.9.0
2025-07-18 12:13:24 +02:00
Kévin Dunglas
f7ea33d328
chore: upgrade Mercure to v0.20
2025-07-18 12:11:51 +02:00
Kévin Dunglas
0c25b2488c
chore: bump deps
2025-07-16 13:29:04 +02:00
Alexander Stecher
a19fcdb38d
fix: forwards php_server root to try_files ( #1729 )
...
* Adds 'root' to try_files.
* Formatting.
* Fixes test with wrong assumption.
* Adds more test cases.
* Prevents conflicts with other tests.
2025-07-16 11:58:36 +02:00
Kévin Dunglas
6be261169a
chore: prepare release 1.8.0
2025-07-01 15:43:12 +02:00
Luffy
ac900e0df4
docs: update repository links and sync cn readme ( #1711 )
2025-07-01 10:29:55 +02:00
Kévin Dunglas
40ee7929a1
chore: bump deps ( #1708 )
2025-07-01 10:29:21 +02:00