Overview

Namespaces

  • Composer
    • Autoload
  • Guzzle
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Mock
    • Stream
  • Mockery
    • Adapter
      • Phpunit
    • CountValidator
    • Exception
    • Generator
      • StringManipulation
        • Pass
    • Loader
    • Matcher
  • None
  • Omnipay
    • Common
      • Exception
      • Message
    • Dummy
      • Message
    • Fatzebra
      • Message
  • PHP
  • Symfony
    • Component
      • EventDispatcher
        • Debug
        • DependencyInjection
        • Tests
          • Debug
          • DependencyInjection
      • HttpFoundation
        • File
          • Exception
          • MimeType
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
        • Tests
          • File
            • MimeType
          • Session
            • Attribute
            • Flash
            • Storage
              • Handler
              • Proxy
      • Yaml
        • Exception
        • Tests

Classes

  • AcceptHeader
  • AcceptHeaderItem
  • ApacheRequest
  • BinaryFileResponse
  • Cookie
  • ExpressionRequestMatcher
  • FileBag
  • HeaderBag
  • IpUtils
  • JsonResponse
  • ParameterBag
  • RedirectResponse
  • Request
  • RequestMatcher
  • RequestStack
  • Response
  • ResponseHeaderBag
  • ServerBag
  • StreamedResponse

Interfaces

  • RequestMatcherInterface
  • Overview
  • Namespace
  • Class
  • Tree

Class JsonResponse

Response represents an HTTP response in JSON format.

Note that this class does not force the returned JSON content to be an object. It is however recommended that you do return an object as it protects yourself against XSSI and JSON-JavaScript Hijacking.

Symfony\Component\HttpFoundation\Response
Extended by Symfony\Component\HttpFoundation\JsonResponse
Namespace: Symfony\Component\HttpFoundation
Author: Igor Wiedler igor@wiedler.ch
See: https://www.owasp.org/index.php/OWASP_AJAX_Security_Guidelines#Always_return_JSON_with_an_Object_on_the_outside
Located at JsonResponse.php
Methods summary
public
# __construct( mixed $data = null, integer $status = 200, array $headers = array() )

Constructor.

Constructor.

Parameters

$data
The response data
$status
The response status code
$headers
An array of response headers

Throws

InvalidArgumentException
When the HTTP status code is not valid

Overrides

Symfony\Component\HttpFoundation\Response::__construct()
public static Symfony\Component\HttpFoundation\Response
# create( mixed $data = null, integer $status = 200, array $headers = array() )

Factory method for chainability.

Factory method for chainability.

Parameters

$data
$content The response content, see setContent()
$status
The response status code
$headers
An array of response headers

Returns

Symfony\Component\HttpFoundation\Response

Overrides

Symfony\Component\HttpFoundation\Response::create()
public Symfony\Component\HttpFoundation\JsonResponse
# setCallback( string|null $callback = null )

Sets the JSONP callback.

Sets the JSONP callback.

Parameters

$callback
The JSONP callback or null to use none

Returns

Symfony\Component\HttpFoundation\JsonResponse

Throws

InvalidArgumentException
When the callback name is not valid
public Symfony\Component\HttpFoundation\JsonResponse
# setData( mixed $data = array() )

Sets the data to be sent as JSON.

Sets the data to be sent as JSON.

Parameters

$data

Returns

Symfony\Component\HttpFoundation\JsonResponse

Throws

InvalidArgumentException
public integer
# getEncodingOptions( )

Returns options used while encoding data to JSON.

Returns options used while encoding data to JSON.

Returns

integer
public Symfony\Component\HttpFoundation\JsonResponse
# setEncodingOptions( integer $encodingOptions )

Sets options used while encoding data to JSON.

Sets options used while encoding data to JSON.

Parameters

$encodingOptions

Returns

Symfony\Component\HttpFoundation\JsonResponse
protected Symfony\Component\HttpFoundation\JsonResponse
# update( )

Updates the content and headers according to the JSON data and callback.

Updates the content and headers according to the JSON data and callback.

Returns

Symfony\Component\HttpFoundation\JsonResponse
Methods inherited from Symfony\Component\HttpFoundation\Response
__clone(), __toString(), closeOutputBuffers(), ensureIEOverSSLCompatibility(), expire(), getAge(), getCharset(), getContent(), getDate(), getEtag(), getExpires(), getLastModified(), getMaxAge(), getProtocolVersion(), getStatusCode(), getTtl(), getVary(), hasVary(), isCacheable(), isClientError(), isEmpty(), isForbidden(), isFresh(), isInformational(), isInvalid(), isNotFound(), isNotModified(), isOk(), isRedirect(), isRedirection(), isServerError(), isSuccessful(), isValidateable(), mustRevalidate(), prepare(), send(), sendContent(), sendHeaders(), setCache(), setCharset(), setClientTtl(), setContent(), setDate(), setEtag(), setExpires(), setLastModified(), setMaxAge(), setNotModified(), setPrivate(), setProtocolVersion(), setPublic(), setSharedMaxAge(), setStatusCode(), setTtl(), setVary()
Constants inherited from Symfony\Component\HttpFoundation\Response
HTTP_ACCEPTED, HTTP_ALREADY_REPORTED, HTTP_BAD_GATEWAY, HTTP_BAD_REQUEST, HTTP_CONFLICT, HTTP_CONTINUE, HTTP_CREATED, HTTP_EXPECTATION_FAILED, HTTP_FAILED_DEPENDENCY, HTTP_FORBIDDEN, HTTP_FOUND, HTTP_GATEWAY_TIMEOUT, HTTP_GONE, HTTP_IM_USED, HTTP_INSUFFICIENT_STORAGE, HTTP_INTERNAL_SERVER_ERROR, HTTP_I_AM_A_TEAPOT, HTTP_LENGTH_REQUIRED, HTTP_LOCKED, HTTP_LOOP_DETECTED, HTTP_METHOD_NOT_ALLOWED, HTTP_MOVED_PERMANENTLY, HTTP_MULTIPLE_CHOICES, HTTP_MULTI_STATUS, HTTP_NETWORK_AUTHENTICATION_REQUIRED, HTTP_NON_AUTHORITATIVE_INFORMATION, HTTP_NOT_ACCEPTABLE, HTTP_NOT_EXTENDED, HTTP_NOT_FOUND, HTTP_NOT_IMPLEMENTED, HTTP_NOT_MODIFIED, HTTP_NO_CONTENT, HTTP_OK, HTTP_PARTIAL_CONTENT, HTTP_PAYMENT_REQUIRED, HTTP_PERMANENTLY_REDIRECT, HTTP_PRECONDITION_FAILED, HTTP_PRECONDITION_REQUIRED, HTTP_PROCESSING, HTTP_PROXY_AUTHENTICATION_REQUIRED, HTTP_REQUESTED_RANGE_NOT_SATISFIABLE, HTTP_REQUEST_ENTITY_TOO_LARGE, HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, HTTP_REQUEST_TIMEOUT, HTTP_REQUEST_URI_TOO_LONG, HTTP_RESERVED, HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL, HTTP_RESET_CONTENT, HTTP_SEE_OTHER, HTTP_SERVICE_UNAVAILABLE, HTTP_SWITCHING_PROTOCOLS, HTTP_TEMPORARY_REDIRECT, HTTP_TOO_MANY_REQUESTS, HTTP_UNAUTHORIZED, HTTP_UNPROCESSABLE_ENTITY, HTTP_UNSUPPORTED_MEDIA_TYPE, HTTP_UPGRADE_REQUIRED, HTTP_USE_PROXY, HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL, HTTP_VERSION_NOT_SUPPORTED
Properties summary
protected $data
#
protected $callback
#
protected $encodingOptions
#
Properties inherited from Symfony\Component\HttpFoundation\Response
$charset, $content, $headers, $statusCode, $statusText, $statusTexts, $version
Omnipay Fat Zebra / Paystream Gateway Module API Documentation API documentation generated by ApiGen