CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.4 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.4
      • 6.0
      • 5.4
      • 5.3
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Namespace Http

Namespaces

  • Cake\Http\Client

Classes

  • ActionDispatcher

    This class provides compatibility with dispatcher filters and interacting with the controller layers.

    Long term this should just be the controller dispatcher, but for now it will do a bit more than that.

  • BaseApplication

    Base class for application classes.

    The application class is responsible for bootstrapping the application, and ensuring that middleware is attached. It is also invoked as the last piece of middleware, and delegates request/response handling to the correct controller.

  • CallbackStream

    Implementation of PSR HTTP streams.

    This differs from Zend\Diactoros\Callback stream in that it allows the use of echo inside the callback, and gracefully handles the callback not returning a string.

    Ideally we can amend/update diactoros, but we need to figure that out with the diactoros project. Until then we'll use this shim to provide backwards compatibility with existing CakePHP apps.

  • Client

    The end user interface for doing HTTP requests.

    Scoped clients

    If you're doing multiple requests to the same hostname its often convenient to use the constructor arguments to create a scoped client. This allows you to keep your code DRY and not repeat hostnames, authentication, and other options.

    Doing requests

    Once you've created an instance of Client you can do requests using several methods. Each corresponds to a different HTTP method.

    • get()
    • post()
    • put()
    • delete()
    • patch()

    Cookie management

    Client will maintain cookies from the responses done with a client instance. These cookies will be automatically added to future requests to matching hosts. Cookies will respect the Expires, Path and Domain attributes. You can get the list of currently stored cookies using the cookies() method.

    You can use the 'cookieJar' constructor option to provide a custom cookie jar instance you've restored from cache/disk. By default an empty instance of Cake\Http\Client\CookieCollection will be created.

    Sending request bodies

    By default any POST/PUT/PATCH/DELETE request with $data will send their data as application/x-www-form-urlencoded unless there are attached files. In that case multipart/form-data will be used.

    When sending request bodies you can use the type option to set the Content-Type for the request:

    $http->get('/users', [], ['type' => 'json']);

    The type option sets both the Content-Type and Accept header, to the same mime type. When using type you can use either a full mime type or an alias. If you need different types in the Accept and Content-Type headers you should set them manually and not use type

    Using authentication

    By using the auth key you can use authentication. The type sub option can be used to specify which authentication strategy you want to use. CakePHP comes with a few built-in strategies:

    • Basic
    • Digest
    • Oauth

    Using proxies

    By using the proxy key you can set authentication credentials for a proxy if you need to use one.. The type sub option can be used to specify which authentication strategy you want to use. CakePHP comes with built-in support for basic authentication.

  • ControllerFactory

    Factory method for building controllers from request/response pairs.

  • MiddlewareQueue

    Provides methods for creating and manipulating a "queue" of middleware callables. This queue is used to process a request and response via \Cake\Http\Runner.

  • RequestTransformer

    Translate and transform from PSR7 requests into CakePHP requests.

    This is an important step for maintaining backwards compatibility with existing CakePHP applications, which depend on the CakePHP request object.

    There is no reverse transform as the 'application' cannot return a mutated request object.

  • Response

    Cake Response is responsible for managing the response text, status and headers of a HTTP response.

    By default controllers will use this class to render their response. If you are going to use a custom response class it should subclass this object in order to ensure compatibility.

  • ResponseEmitter

    Emits a Response to the PHP Server API.

    This emitter offers a few changes from the emitters offered by diactoros:

    • It logs headers sent using CakePHP's logging tools.
    • Cookies are emitted using setcookie() to not conflict with ext/session
  • ResponseTransformer

    This class converts PSR7 responses into CakePHP ones and back again.

    By bridging the CakePHP and PSR7 responses together, applications can be embedded as PSR7 middleware in a fully compatible way.

  • Runner

    Executes the middleware queue and provides the next callable that allows the queue to be iterated.

  • Server

    Runs an application invoking all the PSR7 middleware and the registered application.

  • ServerRequest

    A class that helps wrap Request information and particulars about a single request. Provides methods commonly used to introspect on the request headers and request body.

  • ServerRequestFactory

    Factory for making ServerRequest instances.

    This subclass adds in CakePHP specific behavior to populate the basePath and webroot attributes. Furthermore the Uri's path is corrected to only contain the 'virtual' path for the request.

OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs