ConnectionManager
abstract class ConnectionManager
Connection manager.
Traits
Configurable trait.
Properties
protected string | $default | Name of the default connection. | from ConfigurableTrait |
protected array | $configurations | Configurations. | from ConfigurableTrait |
protected array | $connections | Connections. |
Methods
mixed
connect(string $connection)
Connects to the chosen configuration and returns the connection.
mixed
connection(string|null $connection = null)
Returns the chosen connection.
close(string|null $connection = null)
Closes the chosen connection.
mixed
executeAndClose(Closure $closure, string|null $connection = null)
Executes the passed closure using the chosen connection before closing it.
mixed
__call(string $name, array $arguments)
Magic shortcut to the default connection.
Details
in ConfigurableTrait at line 37
__construct(string $default, array $configurations)
Constructor.
in ConfigurableTrait at line 50
addConfiguration(string $name, array $configuration)
Adds a configuration.
in ConfigurableTrait at line 61
removeConfiguration(string $name)
Removes a configuration.
It will also remove any active connection linked to the configuration.
at line 37
abstract protected mixed
connect(string $connection)
Connects to the chosen configuration and returns the connection.
at line 45
mixed
connection(string|null $connection = null)
Returns the chosen connection.
at line 62
close(string|null $connection = null)
Closes the chosen connection.
at line 87
mixed
executeAndClose(Closure $closure, string|null $connection = null)
Executes the passed closure using the chosen connection before closing it.
at line 103
mixed
__call(string $name, array $arguments)
Magic shortcut to the default connection.