sunrise-php / http-header-kit Goto Github PK
View Code? Open in Web Editor NEW⚠️ This package was moved to the http-message package and is abandoned.
License: MIT License
⚠️ This package was moved to the http-message package and is abandoned.
License: MIT License
Sunrise\Http\Header\HeaderCollection
class does not exist in repository.
https://github.com/sunrise-php/http-header-kit#http-header-collection
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
.circleci/config.yml
cimg/php 7.4
cimg/php 8.0
cimg/php 8.1
composer.json
php >=7.4
sunrise/http-header ^3.0
phpunit/phpunit ~9.5.0
sunrise/coding-standard ~1.0.0
sunrise/uri ~1.2.0
->withHeader(...new HeaderWWWAuthenticate(HeaderWWWAuthenticate::HTTP_AUTHENTICATE_SCHEME_BEARER))
INFO: InvalidArgument - src/Middleware/ErrorHandlingMiddleware.php:111:29 - Method Psr\Http\Message\ResponseInterface::withHeader called with unpacked iterable Sunrise\Http\Header\HeaderWWWAuthenticate with invalid key (must be int|string) (see https://psalm.dev/004)
->withHeader(...new HeaderWWWAuthenticate(HeaderWWWAuthenticate::HTTP_AUTHENTICATE_SCHEME_BEARER));
What do you think about a helper method that takes your classes and returns an array of formatted headers suitable for the ServerRequest
?
$headers = \Sunrise\Http\Headers::make([
new HeaderCookie('whatever'),
new HeaderContentEncoding('multipart/form-data')
new HeaderSomethingElse('foo')
]);
$request = new ServerRequest('POST', 'https://example.com', $headers, 'Whatever');
Hi. Thanks for http-header-kit. Tons of handy tools in here.
A couple of related questions
https://github.com/sunrise-php/http-header-kit/blob/master/src/AbstractHeader.php#L26 has @inheritdoc
but it does not inherit from anything.
If I do something like this
$handler = new class implements RequestHandlerInterface {
public function handle(\Psr\Http\Message\ServerRequestInterface $request): \Psr\Http\Message\ResponseInterface
{
$response = new \GuzzleHttp\Psr7\Response(200, [], 'Hello world');
$response = (new \Sunrise\Http\Header\HeaderContentType('text/plain'))->setToMessage($response);
return $response;
}
};
phpstan and phpStorm both complain that $response
is a MessageInterface instead of a ResponseInterface
Would you consider changing the return types in AbstractHeader to eg
/**
* @return MessageInterface|RequestInterface|ServerRequestInterface|ResponseInterface
*/
public function setToMessage(MessageInterface $message);
to keep these tools happy?
or (alternatively) providing strictly typed variants eg
/**
* @return ServerRequestInterface
*/
public function setToServerRequest(ServerRequestInterface $message): ServerRequestInterface;
and similar for MessageInterface, ResponseInterface, RequestInterface etc
What about Sunset also? https://tools.ietf.org/id/draft-wilde-sunset-header-03.html
Originally posted by @cjunge-work in #1 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.