ytake / laravel-voltdb
VoltDB providers for Laravel
Fund package maintenance!
ytake
Requires
- php: >=5.4.0
- ext-curl: *
- illuminate/auth: 5.*
- illuminate/cache: 5.*
- illuminate/config: 5.*
- illuminate/console: 5.*
- illuminate/container: 5.*
- illuminate/contracts: 5.*
- illuminate/database: 5.*
- illuminate/encryption: 5.*
- illuminate/events: 5.*
- illuminate/filesystem: 5.*
- illuminate/hashing: 5.*
- illuminate/http: 5.*
- illuminate/session: 5.*
- illuminate/support: 5.*
- ytake/voltdb-client-wrapper: 0.*
Requires (Dev)
- mockery/mockery: 0.*
- phpunit/phpunit: 4.*
- satooshi/php-coveralls: dev-master
- symfony/console: 2.*
- symfony/framework-bundle: 2.*
Suggests
- ext-voltdb: for AuthDriver, SessionDriver, CacheDriver. use extension https://github.com/VoltDB/voltdb-client-php/tree/native
This package is auto-updated.
Last update: 2024-10-04 23:23:28 UTC
README
##for laravel5 Laravel4 Laravel.VoltDB
#Install
required ext-voltdb, ext-curl
Add the package to your composer.json and run composer update.
"require": { "php": ">=5.4.0", "ytake/laravel-voltdb": "1.*" },
Add the service provider in app/config/app.php:
'providers' => [ 'Ytake\LaravelVoltDB\VoltDBServiceProvider', ];
Add the aliases in app/config/app.php:
'aliases' => [ 'VoltDBApi' => 'Ytake\LaravelVoltDB\VoltDBFacade', ];
The service provider will register a voltdb database extension
not supported Eloquent, QueryBuilder
(VoltDB supports PHP client application development using VoltDB PHP client library.)
#Configure Add database connection
'voltdb' => [ 'driver' => 'voltdb', 'host' => 'localhost', 'username' => '', 'password' => '', 'port' => 21212 ],
by default .env
DB_HOST=localhost
DB_DATABASE=voltdb
DB_USERNAME=username
DB_PASSWORD=secret
CACHE_DRIVER=voltdb
SESSION_DRIVER=voltdb
publish
$ php artisan vendor:publish
#Database Extension ##@AdHoc query
$sql = "INSERT INTO users (user_id, username, password, remember_token, created_at)" ." VALUES (" . rand() . ", 'voltdb', '" . $pass . "', null, '" . date("Y-m-d H:i:s") . "')"; \DB::connection('voltdb')->exec($sql); $sql = "SELECT * FROM users"; \DB::connection('voltdb')->select($sql);
not supported prepared statement
Recommended stored procedure
##stored procedure
\DB::connection('voltdb')->procedure('Auth_findUser', [1]);
#Auth
include voltdb auth driver
in config/auth.php
:
'driver' => 'voltdb',
or .env
#Cache
include voltdb cache driver
in config/cache.php
:
'driver' => 'voltdb', 'voltdb' => [ 'driver' => 'voltdb', ],
#Session
include voltdb session driver
in app/config/session.php
:
'driver' => 'voltdb',
Auth, Cache, Session use Stored Procedure(see schema/ddl.sql)
#publish for auth, cache, session ddl.sql
$ php artisan ytake:voltdb-schema-publish
Options:
--publish (-p) Publish to a specific directory
default storage/schema/ddl.sql
###DDL default ddl
CREATE TABLE users ( user_id INTEGER UNIQUE NOT NULL, username VARCHAR(40) NOT NULL, password VARCHAR(64) NOT NULL, remember_token VARCHAR(128) DEFAULT NULL, created_at TIMESTAMP NOT NULL, PRIMARY KEY(user_id) ); CREATE INDEX UsersIndex ON users (username, password, remember_token); CREATE TABLE caches ( key VARCHAR(255) UNIQUE NOT NULL, value VARCHAR(262144), expiration INTEGER DEFAULT 0 NOT NULL, CONSTRAINT PK_cache PRIMARY KEY (key) ); CREATE INDEX IX_cache_expires ON cache (expiration); CREATE TABLE sessions ( id VARCHAR(255) UNIQUE NOT NULL, payload VARCHAR(65535), last_activity INTEGER DEFAULT 0 NOT NULL ); CREATE INDEX IX_session_id ON sessions (id); CREATE INDEX IX_activity ON sessions (last_activity);
#Facades supported for json interface API
// call stored procedure @SystemInformation \VoltDBApi::request()->info()->getResult(); // basic \VoltDBApi::request()->post([ 'Procedure' => 'addUser', 'Parameters' => [1, "voltdb"] ])->getResult();
###Async Stored Procedure see VoltDB.PHPClientWrapper
#Console
ytake:voltdb-schema-publish publish DDL for auth, cache driver
ytake:voltdb-info information about ytake/laravel-voltdb
ytake:voltdb-system-catalog renderer system catalog
##voltdb-system-catalog
Options:
--component (-c) returns information about the schema of the VoltDB database, depending upon the component keyword you specify.
example
Such as MySQL SHOW COLUMNS
$ php artisan ytake:voltdb-system-catalog -c COLUMNS