Get started¶
Install¶
These pages document the released 3.0.0 Symfony bundle.
Install the 3.x bundle line alongside Core 3:
Bundle 3.0.0 declares:
- PHP
>=8.3; small/swoole-entity-manager-core 3.0.*;- Symfony Config, Console, DependencyInjection and HttpKernel
^7.4 || ^8.0.
The bundle's Core 3.0.* dependency does not accept Core 3.1. Install a compatible Core version with the released bundle, and confirm your PHP extensions and runtime support.
Configuration¶
Create config/packages/small_swoole_entity_manager.yaml:
small_swoole_entity_manager:
default_connection: default
connections:
default:
type: mysql
host: database.my-app.net
port: 3306
encoding: utf8mb4
database: app
user: app
password: secret
max_connections: 50
users:
type: postgres
host: postgres.my-app.net
port: 5432
encoding: UTF8
database: sso_users
user: postgres
password: secret123
max_connections: 25
memory:
type: swoole-db
database_layers:
app: "@projectRoot/databaseLayers"
users: "@UserBundle/Resources/databaseLayers"
layer_parameters:
application_environment: prod
tenant: main
Supported connection types are:
mysql;postgres;swoole-db.
For SQL connections, host, database, user, password and encoding are required. An empty password is allowed when the database configuration intentionally uses one.
port is optional and must be between 1 and 65535. max_connections is optional and must be at least 1. The bundle normalizes these public Symfony-style options to the Core connection configuration (port as a string and maxConnections internally).
A swoole-db connection accepts only its type option.
When connections are configured, default_connection must name one of them.
Database-layer paths¶
database_layers maps a selector to a layer directory.
A path beginning with @projectRoot is resolved from KernelInterface::getProjectDir(). Other @Bundle/... resource paths are resolved through the Symfony kernel.
Only values listed under layer_parameters are passed to Core database layers. The bundle does not expose Symfony's full container parameter bag to migration code.