Connect with Laravel

To connect SingleStore with Laravel, define the connection configuration in the database.php file and add the following options:

'options' => extension_loaded('pdo_mysql') && env('APP_ENV') !== 'testing' && env('APP_ENV') !== 'local' ? array_filter(
           [ PDO::ATTR_EMULATE_PREPARES => true, 
             PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => true, 
             PDO::ATTR_PERSISTENT => true
           ]
) : [],

Here's a sample configuration:

'mysql' => array(
    'read' => array(
        'host' => '<host_url_or_IP_address>',
    ),
    'write' => array(
        'host' => '<host_url_or_IP_address>'
    ),
    'driver' => 'mysql',
    'database' => '<database_name>',
    'username' => '<username>',
    'password' => '<password>',
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix' => '',
),
'options' => extension_loaded('pdo_mysql') && env('APP_ENV') !== 'testing' && env('APP_ENV') !== 'local' ? array_filter(
           [ PDO::ATTR_EMULATE_PREPARES => true, 
             PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => true, 
             PDO::ATTR_PERSISTENT => true 
           ]
) : [],

To enable SSL connections between Managed Service and Laravel, download the singlestore_bundle.pem certificate file and use it to create the connection. Specify the certificate file in database configuration using the PDO::MYSQL_ATTR_SSL_CA attribute, for example:

'options' => extension_loaded('pdo_mysql') && env('APP_ENV') !== 'testing' && env('APP_ENV') !== 'local' ? array_filter(
           [ PDO::MYSQL_ATTR_SSL_CA => resource_path('singlestore/singlestore_bundle.pem'),
             PDO::ATTR_EMULATE_PREPARES => true, 
             PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => true, 
             PDO::ATTR_PERSISTENT => true
           ]
) : [],

See Laravel docs for more information.