mnavarrocarter / php-fetch Goto Github PK
View Code? Open in Web Editor NEWA simple, type-safe, zero dependency port of the javascript fetch WebApi for PHP
License: MIT License
A simple, type-safe, zero dependency port of the javascript fetch WebApi for PHP
License: MIT License
if (feof($this->resource)) {
return null;
}
$result = @fread($this->resource, $bytes);
What does feof
on HTTP level? How can it tell that the stream is over?
As I understand fread
fires a new HTTP request each time. Am I wrong?
<?php
interface ClientError implements Throwable
{
}
class SocketErorr extends Exception implements ClientError
{
}
So that any consuming application can easily isolate error and exception thrown by the library by typeHinting for ClientError
After Adam Wathan: https://youtu.be/crSUWtRYw-M?t=615 (item number #3
)
$status = Status::fromStatusLine($line);
$headers = Headers::fromLines($lines);
$partials[] = new HttpPartialResponse($status, $headers);
// ๐
$partials[] = new HttpPartialResponse(Status::fromStatusLine($line), Headers::fromLines($lines));
What do you think?
functions.php
has the same namespace, so it can live in /src
.
How about a PR?
If I go with only
"phpunit/phpunit": "^9.4",
"symfony/var-dumper": "^5.1",
"amphp/http-server": "^2.1",
"amphp/http-server-static-content": "^1.0",
"mnavarrocarter/amp-http-router": "^0.1.0",
symfony/process will be missing.
and do not indent normal execution.
if (strpos($line, 'HTTP') === 0) {
$status = Status::fromStatusLine($line);
$headers = Headers::fromLines($lines);
$partials[] = new HttpPartialResponse($status, $headers);
}
// ๐
if (strpos($line, 'HTTP') !== 0) {
continue;
}
$status = Status::fromStatusLine($line);
$headers = Headers::fromLines($lines);
$partials[] = new HttpPartialResponse($status, $headers);
How about that?
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.