Skip to content
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

Need more explanation on how to use the library without composer #71

Open
ghost opened this issue Sep 18, 2018 · 1 comment
Open

Need more explanation on how to use the library without composer #71

ghost opened this issue Sep 18, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 18, 2018

I get this error after installing the library with composer:

PHP Fatal error:  Uncaught Error: Class 'JsonStreamingParser\Listener\InMemoryListener' not found in /data/www/default/database/json_to_sql.php:14
Stack trace:
#0 {main}
  thrown in /data/www/default/database/json_to_sql.php on line 14

json_to_sql.php

require_once 'vendor/autoload.php';
$json_file = dirname(__FILE__) . "file.json";

# Load json data from the file into a variable
Line 14 -> $listener = new \JsonStreamingParser\Listener\InMemoryListener();

$stream = fopen($json_file, 'r');
try {
    $parser = new \JsonStreamingParser\Parser($stream, $listener);
    $parser->parse();
    fclose($stream);
} catch (Exception $e) {
    fclose($stream);
    throw $e;
}

$json_data = $listener->getJson();
var_dump($json_data);

I've installed the library with downloading the composer.json file and doing php composer.phar install.

$ php composer.phar diagnose                                              
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: 

  [Symfony\Component\Process\Exception\RuntimeException]
  The Process class relies on proc_open, which is not available on your PHP installation.

diagnose

When I clone the repository it gives me the same error. I don't know if I have to do an include or something, there is no example.

@tschallacka
Copy link

tschallacka commented Sep 19, 2018

this seems to be a php issue for you to be able to run composer. It seems that composer wishes to run a few git commands to test things. for that it needs to be able to execute git.
This causes autoload not to be generated or files properly loaded.

Just a hunch. Check your php settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant