framework/src/Api/JsonApiResponse.php
Franz Liedke 3ff230dc26 Change API to use PSR-7 style requests and responses
This required some interface changes (mostly changing Laravel's or
Symfony's request and response classes to those of Zend's Diactoros.
Some smaller changes to the execution flow in a few of the abstract
action base classes, but nothing substantial.

Note: The request and response classes are immutable, so we usually
need to return new instances after modifying the old ones.
2015-05-27 01:55:05 +02:00

15 lines
340 B
PHP

<?php namespace Flarum\Api;
use Tobscure\JsonApi\Document;
use Zend\Diactoros\Response;
class JsonApiResponse extends Response
{
public function __construct(Document $document)
{
parent::__construct('php://memory', 200, ['content-type' => 'application/vnd.api+json']);
$this->getBody()->write($document);
}
}