Manager
class Manager
Standalone database manager for non-production use outside full application bootstrap.
Uses SimpleConnectionResolver to retain non-pooled connections, including in-memory SQLite databases, without requiring full application bootstrap.
For production Swoole applications with connection pooling, use the full Hypervel application with ConnectionResolver instead.
Traits
Properties
| static protected object|null | $instance | The current globally used instance. |
from CapsuleManagerTrait |
| protected Container | $container | The container instance. |
from CapsuleManagerTrait |
| protected DatabaseManager | $manager | The database manager instance. |
Methods
Setup the default database configuration options.
Build the database manager instance.
Get a connection instance from the global manager.
Get a registered connection instance.
Register a connection with the manager.
Bootstrap Eloquent so it is ready for usage.
Get the database manager instance.
Get the current event dispatcher instance.
Set the event dispatcher instance to be used by connections.
Dynamically pass methods to the default connection.
Details
in
CapsuleManagerTrait at line 26
protected void
setupContainer(Container $container)
Setup the IoC container instance.
in
CapsuleManagerTrait at line 41
void
setAsGlobal()
Make this capsule instance available globally.
Swaps the global Capsule instance used by static calls; request-time use races across coroutines.
in
CapsuleManagerTrait at line 50
Container
getContainer()
Get the IoC container instance.
in
CapsuleManagerTrait at line 61
void
setContainer(Container $container)
Set the IoC container instance.
Swaps the Capsule container used by this standalone manager; request-time use races across coroutines.
in
CapsuleManagerTrait at line 70
static void
flushState()
Flush all static state.
at line 46
__construct(Container|null $container = null)
Create a new database capsule manager.
at line 61
protected void
setupDefaultConfiguration()
Setup the default database configuration options.
at line 71
protected void
setupManager()
Build the database manager instance.
at line 89
static Connection
connection(string|null $connection = null)
Get a connection instance from the global manager.
at line 97
static Builder
table(Closure|Builder|Builder|Relation|Expression|UnitEnum|string $table, string|null $as = null, string|null $connection = null)
Get a fluent query builder instance.
at line 105
static Builder
schema(string|null $connection = null)
Get a schema builder instance.
at line 113
Connection
getConnection(string|null $name = null)
Get a registered connection instance.
at line 121
void
addConnection(array $config, string $name = 'default')
Register a connection with the manager.
at line 137
void
bootEloquent()
Bootstrap Eloquent so it is ready for usage.
The resolver and dispatcher persist in Eloquent's static properties for the worker lifetime and are used by every model across all coroutines.
at line 156
DatabaseManager
getDatabaseManager()
Get the database manager instance.
at line 164
Dispatcher|null
getEventDispatcher()
Get the current event dispatcher instance.
at line 176
void
setEventDispatcher(Dispatcher $dispatcher)
Set the event dispatcher instance to be used by connections.
at line 184
static mixed
__callStatic(string $method, array $parameters)
Dynamically pass methods to the default connection.