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 5.0 Chiffon API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 5.0
      • 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
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
      • Client
      • Cookie
      • Exception
      • Middleware
      • Session
      • TestSuite
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View

Class StreamFactory

Factory class for creating stream instances.

Namespace: Cake\Http

Method Summary

  • createStream() public

    Create a new stream from a string.

  • createStreamFromFile() public

    Create a stream from an existing file.

  • createStreamFromResource() public

    Create a new stream from an existing resource.

Method Detail

createStream() ¶ public

createStream(string $content = ''): StreamInterface

Create a new stream from a string.

The stream SHOULD be created with a temporary resource.

Parameters
string $content optional

String content with which to populate the stream.

Returns
StreamInterface

createStreamFromFile() ¶ public

createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface

Create a stream from an existing file.

The file MUST be opened using the given mode, which may be any mode supported by the fopen function.

The $filename MAY be any string supported by fopen().

Parameters
string $filename

The filename or stream URI to use as basis of stream.

string $mode optional

The mode with which to open the underlying filename/stream.

Returns
StreamInterface
Throws
RuntimeException
If the file cannot be opened.
InvalidArgumentException
If the mode is invalid.

createStreamFromResource() ¶ public

createStreamFromResource(resource $resource): StreamInterface

Create a new stream from an existing resource.

The stream MUST be readable and may be writable.

Parameters
resource $resource

The PHP resource to use as the basis for the stream.

Returns
StreamInterface
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