CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 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

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • AbstractTransport
  • Email
  • Mailer
  • TransportFactory
  • TransportRegistry

Traits

  • MailerAwareTrait

Class TransportFactory

Factory class for generating email transport instances.

Cake\Mailer\TransportFactory uses Cake\Core\StaticConfigTrait
Namespace: Cake\Mailer
Location: Mailer/TransportFactory.php

Properties summary

  • $_dsnClassMap protected static
    array
    An array mapping url schemes to fully qualified Transport class names
  • $_registry protected static
    Cake\Mailer\TransportRegistry
    Transport Registry used for creating and using transport instances.

Inherited Properties

  • _config

Method Summary

  • _buildTransport() protected static
    Finds and builds the instance of the required tranport class.
  • get() public static
    Get transport instance.
  • getRegistry() public static
    Returns the Transport Registry used for creating and using transport instances.
  • setRegistry() public static
    Sets the Transport Registry instance used for creating and using transport instances.

Method Detail

_buildTransport() protected static ¶

_buildTransport( string $name )

Finds and builds the instance of the required tranport class.

Parameters
string $name
Name of the config array that needs a tranport instance built
Throws
InvalidArgumentException
When a tranport cannot be created.

get() public static ¶

get( string $name )

Get transport instance.

Parameters
string $name
Config name.
Returns
Cake\Mailer\AbstractTransport

getRegistry() public static ¶

getRegistry( )

Returns the Transport Registry used for creating and using transport instances.

Returns
Cake\Mailer\TransportRegistry

setRegistry() public static ¶

setRegistry( Cake\Mailer\TransportRegistry $registry )

Sets the Transport Registry instance used for creating and using transport instances.

Also allows for injecting of a new registry instance.

Parameters
Cake\Mailer\TransportRegistry $registry
Injectable registry object.

Methods used from Cake\Core\StaticConfigTrait

config() public static deprecated ¶

config( string|array $key , array|null $config = null )

This method can be used to define configuration adapters for an application or read existing configuration.

To change an adapter's configuration at runtime, first drop the adapter and then reconfigure it.

Adapters will not be constructed until the first operation is done.

Usage

Assuming that the class' name is Cache the following scenarios are supported:

Reading config data back:

Cache::config('default');

Setting a cache engine up.

Cache::config('default', $settings);

Injecting a constructed adapter in:

Cache::config('default', $instance);

Configure multiple adapters at once:

Cache::config($arrayOfConfig);
Deprecated
3.4.0 Use setConfig()/getConfig() instead.
Parameters
string|array $key
The name of the configuration, or an array of multiple configs.
array|null $config optional null
An array of name => configuration data for adapter.
Returns
array|null
Null when adding configuration or an array of configuration data when reading.
Throws
BadMethodCallException
When trying to modify an existing config.

configured() public static ¶

configured( )

Returns an array containing the named configurations

Returns
string[]
Array of configurations.

drop() public static ¶

drop( string $config )

Drops a constructed adapter.

If you wish to modify an existing configuration, you should drop it, change configuration and then re-add it.

If the implementing objects supports a $_registry object the named configuration will also be unloaded from the registry.

Parameters
string $config
An existing configuration you wish to remove.
Returns
boolean
Success of the removal, returns false when the config does not exist.

dsnClassMap() public static deprecated ¶

dsnClassMap( array $map = null )

Returns or updates the DSN class map for this class.

Deprecated
3.4.0 Use setDsnClassMap()/getDsnClassMap() instead.
Parameters
array $map optional null
Additions/edits to the class map to apply.
Returns
array

getConfig() public static ¶

getConfig( string $key )

Reads existing configuration.

Parameters
string $key
The name of the configuration.
Returns
mixed
Configuration data at the named key or null if the key does not exist.

getDsnClassMap() public static ¶

getDsnClassMap( )

Returns the DSN class map for this class.

Returns
array

parseDsn() public static ¶

parseDsn( string $dsn )

Parses a DSN into a valid connection configuration

This method allows setting a DSN using formatting similar to that used by PEAR::DB. The following is an example of its usage:

$dsn = 'mysql://user:pass@localhost/database?';
$config = ConnectionManager::parseDsn($dsn);

$dsn = 'Cake\Log\Engine\FileLog://?types=notice,info,debug&file=debug&path=LOGS';
$config = Log::parseDsn($dsn);

$dsn = 'smtp://user:secret@localhost:25?timeout=30&client=null&tls=null';
$config = Email::parseDsn($dsn);

$dsn = 'file:///?className=\My\Cache\Engine\FileEngine';
$config = Cache::parseDsn($dsn);

$dsn = 'File://?prefix=myapp_cake_core_&serialize=true&duration=+2 minutes&path=/tmp/persistent/';
$config = Cache::parseDsn($dsn);

For all classes, the value of scheme is set as the value of both the className unless they have been otherwise specified.

Note that querystring arguments are also parsed and set as values in the returned configuration.

Parameters
string $dsn
The DSN string to convert to a configuration array
Returns
array
The configuration array to be stored after parsing the DSN
Throws
InvalidArgumentException
If not passed a string, or passed an invalid string

setConfig() public static ¶

setConfig( string|array $key , array $config = null )

This method can be used to define configuration adapters for an application.

To change an adapter's configuration at runtime, first drop the adapter and then reconfigure it.

Adapters will not be constructed until the first operation is done.

Usage

Assuming that the class' name is Cache the following scenarios are supported:

Setting a cache engine up.

Cache::setConfig('default', $settings);

Injecting a constructed adapter in:

Cache::setConfig('default', $instance);

Configure multiple adapters at once:

Cache::setConfig($arrayOfConfig);
Parameters
string|array $key
The name of the configuration, or an array of multiple configs.
array $config optional null
An array of name => configuration data for adapter.
Throws
BadMethodCallException
When trying to modify an existing config.
LogicException
When trying to store an invalid structured config array.

setDsnClassMap() public static ¶

setDsnClassMap( array $map )

Updates the DSN class map for this class.

Parameters
array $map
Additions/edits to the class map to apply.

Properties detail

$_dsnClassMap ¶

protected static array

An array mapping url schemes to fully qualified Transport class names

[
    'debug' => 'Cake\Mailer\Transport\DebugTransport',
    'mail' => 'Cake\Mailer\Transport\MailTransport',
    'smtp' => 'Cake\Mailer\Transport\SmtpTransport',
]

$_registry ¶

protected static Cake\Mailer\TransportRegistry

Transport Registry used for creating and using transport instances.

Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs