mirror of
https://github.com/halaxa/json-machine.git
synced 2025-01-17 13:08:16 +01:00
/src/examples -> /examples
This commit is contained in:
parent
77862b1ba2
commit
4d47309576
@ -112,7 +112,7 @@ However **built-in decoders depend on it** so it must be present if you use them
|
||||
- Throws `UnexpectedEndSyntaxErrorException` on an unexpected end of JSON structure (thanks @gabimem)
|
||||
- Function `httpClientChunks()` is **deprecated** so that compatibility with Symfony HttpClient
|
||||
is not on the shoulders of JSON Machine maintainer. The code is simple and everyone can make their own
|
||||
function and maintain it. The code was moved to [examples](src/examples/symfonyHttpClient.php).
|
||||
function and maintain it. The code was moved to [examples](examples/symfonyHttpClient.php).
|
||||
- Function `objects()` is **deprecated**. The way `objects()` works is that it casts decoded arrays
|
||||
to objects. It brings some unnecessary overhead and risks on huge datasets.
|
||||
Alternative is to use `ExtJsonDecoder` which decodes items as objects by default (same as `json_decode`).
|
||||
|
@ -361,13 +361,13 @@ popular http clients which support streaming responses:
|
||||
Guzzle uses its own streams, but they can be converted back to PHP streams by calling
|
||||
`\GuzzleHttp\Psr7\StreamWrapper::getResource()`. Pass the result of this function to
|
||||
`Items::fromStream` function, and you're set up. See working
|
||||
[GuzzleHttp example](src/examples/guzzleHttp.php).
|
||||
[GuzzleHttp example](examples/guzzleHttp.php).
|
||||
|
||||
<a name="symfony-httpclient"></a>
|
||||
### Symfony HttpClient
|
||||
A stream response of Symfony HttpClient works as iterator. And because JSON Machine is
|
||||
based on iterators, the integration with Symfony HttpClient is very simple. See
|
||||
[HttpClient example](src/examples/symfonyHttpClient.php).
|
||||
[HttpClient example](examples/symfonyHttpClient.php).
|
||||
|
||||
|
||||
<a name="tracking-parsing-progress"></a>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$client = new \GuzzleHttp\Client();
|
||||
$response = $client->request('GET', 'https://httpbin.org/anything?key=value');
|
@ -2,14 +2,14 @@
|
||||
|
||||
use JsonMachine\Items;
|
||||
|
||||
require_once __DIR__.'/../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
ini_set('memory_limit', 128 * 1024 * 1024);
|
||||
|
||||
function dummy()
|
||||
{
|
||||
$i = 0;
|
||||
$string = file_get_contents(__DIR__.'/../../test/performance/twitter_example_0.json');
|
||||
$string = file_get_contents(__DIR__ . '/../../test/performance/twitter_example_0.json');
|
||||
$item = '['.str_repeat($string.',', 400).$string.']';
|
||||
var_dump(strlen($item));
|
||||
|
@ -4,7 +4,7 @@ use JsonMachine\Items;
|
||||
use Symfony\Component\HttpClient\HttpClient;
|
||||
use Symfony\Contracts\HttpClient\ResponseStreamInterface;
|
||||
|
||||
require_once __DIR__.'/../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
function httpClientChunks(ResponseStreamInterface $responseStream)
|
||||
{
|
Loading…
x
Reference in New Issue
Block a user