Skip to content

Add context helper method similar to laravel. #130

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 7, 2025

Conversation

anabeto93
Copy link
Contributor

Added the context() helper method just like laravel has. But this is different as it is in line with https://hypervel.org/docs/context#context in receiving an optional coroutineId

@albertcht albertcht added the enhancement Improved feature or adjustments. label Jun 28, 2025
function context($key = null, $default = null, ?int $coroutineId = null)
{
return match (true) {
is_null($key) => \Hypervel\Context\Context::class,
Copy link
Member

Choose a reason for hiding this comment

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

The return value here is a little bit weird. Consider returning context instance here, and proxy function calls to static method?

* @param int|null $coroutineId
* @return string
*/
function context_set_multiple(array $values, ?int $coroutineId = null): string
Copy link
Member

Choose a reason for hiding this comment

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

This function doesn't exist in Laravel. We can move this method to Context?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes we can. I'll do that

@albertcht albertcht merged commit 5090dac into hypervel:main Aug 7, 2025
10 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved feature or adjustments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants