<?php
namespace ShinyGeoip\Responder;

use ShinyGeoip\Core\Responder;

class ApiRequestResponder extends Responder
{
    /**
     * Echos short version of record as json encodes string.
     */
    public function short()
    {
        $this->setContentTypeHeader('json');
        $record = $this->get('record');
        echo json_encode($record);
        exit;
    }

    /**
     * Echos the full record as json encoded string.
     */
    public function full()
    {
        $this->setContentTypeHeader('json');
        $record = $this->get('record')->jsonSerialize();
        echo json_encode($record);
        exit;
    }

    /**
     * Echos a json encoded not found error message.
     */
    public function notFound()
    {
        $this->setContentTypeHeader('json');
        echo json_encode(['type' => 'error', 'msg' => 'No record found.']);
        exit;
    }
}

<?php
namespace ShinyGeoip\Responder;

use ShinyGeoip\Core\Responder;

class ApiRequestResponder extends Responder
{
    /**
     * Echos short version of record as json encodes string.
     */
    public function short()
    {
        $this->setContentTypeHeader('json');
        $record = $this->get('record');
        echo json_encode($record);
    }

    /**
     * Echos the full record as json encoded string.
     */
    public function full()
    {
        $this->setContentTypeHeader('json');
        $record = $this->get('record')->jsonSerialize();
        echo json_encode($record);
    }

    /**
     * Echos a json encoded not found error message.
     */
    public function notFound()
    {
        $this->setContentTypeHeader('json');
        echo json_encode(['type' => 'error', 'msg' => 'No record found.']);
    }
}

--- 
+++ 
@@ -13,6 +13,7 @@
         $this->setContentTypeHeader('json');
         $record = $this->get('record');
         echo json_encode($record);
+        exit;
     }
 
     /**
@@ -23,6 +24,7 @@
         $this->setContentTypeHeader('json');
         $record = $this->get('record')->jsonSerialize();
         echo json_encode($record);
+        exit;
     }
 
     /**
@@ -32,5 +34,6 @@
     {
         $this->setContentTypeHeader('json');
         echo json_encode(['type' => 'error', 'msg' => 'No record found.']);
+        exit;
     }
 }
Stop script execution after output of json-data so content type header is correct.
