Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Runtime] add middleware to frankenPhp runner#62130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Scarbous wants to merge6 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromScarbous:feature/add-frankenphp-middlware

Conversation

@Scarbous
Copy link

@ScarbousScarbous commentedOct 22, 2025
edited
Loading

QA
Branch?7.4
Bug fix?no
New feature?yes
Deprecations?no
Issues
LicenseMIT

Likephp-runtime/runtime#183

We use tideways in our projects.
We want to use this middleware to enable the request based profiling.

https://support.tideways.com/documentation/setup/installation/frankenphp.html#code-changes-to-frankenphp_handle_request-callback

I want to use a middleware for tideways like this:

class TidewaysMiddlewareimplements MiddlewareInterface{publicfunctionwrap(callable$handler,array$server):void    {if (!$this->checkTideways()) {$handler();return;        }        \Tideways\Profiler::start();try {$handler();        }catch (\Throwable$e) {            \Tideways\Profiler::logException($e);throw$e;        }finally {            \Tideways\Profiler::stop();        }    }privatefunctioncheckTideways():bool    {return !class_exists('Tideways\Profiler') && !\Tideways\Profiler::isEnabled();    }}

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbotcarsonbot changed the titlefeat: add middleware to frankenPhp runner feat: add middleware to frankenPhp runnerOct 22, 2025
@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "7.4" but it seems your PR description refers to branch "7.4 for features / 6.4, 7.3 for bug fixes".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

@ScarbousScarbousforce-pushed thefeature/add-frankenphp-middlware branch froma3fcf78 to9da81f0CompareOctober 22, 2025 15:39
@stof
Copy link
Member

With such middleware API that can run logic before and after our processing but without any access to the request and response (any logic running after the original handler even runs after the response has been sent), I don't see any use case that would be able to reuse that besides the Tideways profiling use case.
And Tideways could make all that unnecessary by instrumenting thefrankenphp_handle_request natively in their extension (as they do for other cases).

@beberlei is there any plan for Tideways to intrument the FrankenPHP worker mode natively, making this PR useless ?

@carsonbotcarsonbot changed the title feat: add middleware to frankenPhp runner[Runtime] feat: add middleware to frankenPhp runnerOct 23, 2025
@ScarbousScarbousforce-pushed thefeature/add-frankenphp-middlware branch fromec7df4d to48840edCompareOctober 24, 2025 05:38
@ScarbousScarbousforce-pushed thefeature/add-frankenphp-middlware branch from48840ed tofd4cfa2CompareOctober 24, 2025 05:57
@Scarbous
Copy link
Author

Appreciate the feedback,@OskarStark and@stof.

@ScarbousScarbousforce-pushed thefeature/add-frankenphp-middlware branch from4e6f02a to37d6d79CompareOctober 24, 2025 06:08
@ScarbousScarbous changed the title[Runtime] feat: add middleware to frankenPhp runner[Runtime] add middleware to frankenPhp runnerOct 24, 2025
@nicolas-grekas
Copy link
Member

nicolas-grekas commentedOct 24, 2025
edited
Loading

This looks too specific to frankenphp and unndeeded I think: it should be possible to decorate the runtime to do this without introducing any new concept (middleware).

publicfunction__construct(
privateHttpKernelInterface$kernel,
privateint$loopMax,
privateiterable$middlewares = [],
Copy link
Member

@nicolas-grekasnicolas-grekasOct 25, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looking again at the patch, there might be a simpler solution:

Suggested change
privateiterable$middlewares =[],
private?\Closure$handler =null,

then$handler ??= frankenphp_handle_request(...)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@stofstofstof left review comments

@OskarStarkOskarStarkOskarStark left review comments

Assignees

No one assigned

Projects

None yet

Milestone

7.4

Development

Successfully merging this pull request may close these issues.

6 participants

@Scarbous@carsonbot@stof@nicolas-grekas@OskarStark@HypeMC

[8]ページ先頭

©2009-2025 Movatter.jp