huangdijia/laravel-ssdb

ssdb for laravel

1.1.4 2020-08-26 09:28 UTC

This package is auto-updated.

Last update: 2024-12-26 19:03:03 UTC


README

Latest Stable Version Total Downloads

Requirements

  • PHP >= 7.0
  • Laravel >= 5.5

Installation

First, install laravel 5.5, and make sure that the database connection settings are correct.

composer require huangdijia/laravel-ssdb

Configurations

// config/database.php

    'ssdb'        => [
        'default'     => 'default',
        'connections' => [
            'default' => [
                'host'     => env('SSDB_HOST', '127.0.0.1'),
                'port'     => env('SSDB_PORT', 8888),
                'timeout'  => env('SSDB_TIMEOUT', 2000),
                'password' => 'your-password', // optional
            ],
        ],
        // ...
    ],

Usage

Connection

$ssdb = Ssdb::connection('default');

As Facades

use Huangdijia\Ssdb\Facades\Ssdb;

...
Ssdb::set('key', 'value');
$value = Ssdb::get('key');

As Helper

ssdb()->set('key', 'value');
ssdb()->get('key');

As Cache Store Driver

// config/cache.php
'default' => 'ssdb',

'ssdb' => [
    'driver'     => 'ssdb',
    'connection' => 'default',
],

or

set .env as

CACHE_DRIVER=ssdb

As Session Manager

// config/session.php
'driver' => 'ssdb',

or

set .env as

SESSION_DRIVER=ssdb

Other

SSDB PHP API

License

laravel-ssdb is licensed under The MIT License (MIT).