Skip to content
Discussion options

You must be logged in to vote

I would usually use mapWithKeys in such a case:

$headers = collect([
    'Content-Type' => 'application/json',
    'X-MyApp-Access-Token' => 'abc123'
]);

$headers = $headers->mapWithKeys(fn ($value, $key) => [ strtolower($key) => $value ]);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@levu42
Comment options

Answer selected by levu42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants