title: Fatal error: Uncaught Error: Class 'Kreait\Firebase\ServiceAccount' not found in
body: <p>I have to learn just now write mobile app web service via fire base.
  I followed this link: <a href="https://firebase-php.readthedocs.io/en/stable/" rel="nofollow noreferrer">https://firebase-php.readthedocs.io/en/stable/</a></p>
  
  <p>In my core website i create web service folder and then create my fire.php file.This file code here,</p>
  
  <pre><code>&lt;?php
  
  require __DIR__.'/vendor/autoload.php';
  
  use Kreait\Firebase\Factory;
  use Kreait\Firebase\ServiceAccount;
  
  $serviceAccount = ServiceAccount::fromJsonFile(__DIR__.'/google-service-account.json');
  $apiKey = 'AIzaSyC_vb5G9qs3NJsywbR34el1RaPj2HDhwNg';
  
  $firebase = (new Factory)
      -&gt;withServiceAccountAndApiKey($serviceAccount, $apiKey)
      -&gt;withDatabaseUri('https://workarea-cb10b.firebaseio.com')
      -&gt;create();
  
  $database = $firebase-&gt;getDatabase();
  
  $newPost = $database
      -&gt;getReference('blog/posts')
      -&gt;push([
          'title' =&gt; 'Post title',
          'body' =&gt; 'This should probably be longer.'
      ]);
  
  $newPost-&gt;getKey(); // =&gt; -KVr5eu8gcTv7_AHb-3-
  $newPost-&gt;getUri(); // =&gt; https://my-project.firebaseio.com/blog/posts/-KVr5eu8gcTv7_AHb-3-
  
  $newPost-&gt;getChild('title')-&gt;set('Changed post title');
  $newPost-&gt;getValue(); // Fetches the data from the realtime database
  $newPost-&gt;remove();
  </code></pre>
  
  <p>I have to call my support file here: <a href="https://github.com/kreait/firebase-php/" rel="nofollow noreferrer">https://github.com/kreait/firebase-php/</a></p>
  
  <p>But still I got a:</p>
  
  <blockquote>
    <p>Fatal error: Uncaught Error: Class 'Kreait\Firebase\ServiceAccount'
    not found in
    /opt/lampp/htdocs/workarea/webservice/firebase/fire.php:13 Stack
    trace: #0 {main} thrown in
    /opt/lampp/htdocs/workarea/webservice/firebase/fire.php on line 13</p>
  </blockquote>
  
  <p>issue have to fix this issue. Kindly check and help me.</p>
  
  <p>My <code>composer.json</code> file</p>
  
  <pre><code>{
      "name": "kreait/firebase-php",
      "description": "Firebase Admin SDK",
      "keywords": ["firebase", "google", "sdk", "api", "database"],
      "homepage": "https://github.com/kreait/firebase-php",
      "license": "MIT",
      "authors": [
          { "name": "Jérôme Gamez", "homepage": "https://github.com/jeromegamez" }
      ],
      "require": {
          "php": "^7.0",
          "ext-mbstring": "*",
          "ext-openssl": "*",
          "fig/http-message-util": "^1.1",
          "google/auth": "^0.11.0|^1.0",
          "guzzlehttp/guzzle": "^6.2.1",
          "kreait/firebase-tokens": "^1.1.1",
          "lcobucci/jwt": "^3.2",
          "mtdowling/jmespath.php": "^2.3"
      },
      "require-dev": {
          "friendsofphp/php-cs-fixer": "^2.0",
          "phpstan/phpstan-phpunit": "^0.9.2",
          "phpunit/phpunit": "^6.0"
      },
      "autoload": {
          "psr-4": {
              "Kreait\\": "src"
          }
      },
      "autoload-dev": {
          "psr-4": {
              "Kreait\\Tests\\": "tests"
          }
      },
      "config": {
          "platform": {
              "php": "7.0"
          },
          "sort-packages": true
      },
      "extra": {
          "branch-alias": {
              "dev-master": "3.x-dev"
          }
      }
  }
  </code></pre>