2017 © Pedro Peláez
 

library eloquent-rest-bridge

A connection driver for eloquent that forwards sql statements over HTTP and returns the data back into an eloquent model.

image

andrewlamers/eloquent-rest-bridge

A connection driver for eloquent that forwards sql statements over HTTP and returns the data back into an eloquent model.

  • Wednesday, May 30, 2018
  • by emaw
  • Repository
  • 1 Watchers
  • 0 Stars
  • 74 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 7 Versions
  • 14 % Grown

The README.md

Eloquent Rest Bridge

A connection driver for the illuminate database manager that forwards sql statements over http to a service running on the target host machine., (*1)

This significantly reduces the transfer size of traditional connections made over a tcp connection., (*2)

The host machine will execute the sql statements and return the results back in json format that gets parsed back into the database manager as if it was a direct database connection., (*3)

SSL is supported but not required as all request and response bodies are encrypted by AES with a pre-shared key., (*4)

This is only really useful for retrieving results through a limited bandwidth connection, or through firewalls. The reduced transfer size allows response times to be much quicker than tunneling raw database commands through a port over SSH., (*5)

Installation

composer require andrewlamers/eloquent-rest-bridge

Laravel Service Provider

Include this in your config/app.php list of service providers., (*6)

Andrewlamers\EloquentRestBridge\ServiceProvider::class

Laravel configuration file

There is an included configuration file for laravel that allows you to modify configuration of the rest bridge., (*7)

To move the configuration file to your projects config/ folder use the following command., (*8)

php artisan vendor:publish --provider="Andrewlamers\EloquentRestBridge\ServiceProvider"

Configuration Options

return array(
    'encryption' => [

        /*
         * Available ciphers are AES-256-CBC and AES-128-CBC
         */
        'cipher' => env('REST_BRIDGE_CIPHER', 'AES-256-CBC'),

        /*
         * The key must match the cipher. AES-256 must be a 32 bit key, and AES-128 must be a 16 byte key
         * You can use the php artisan key:generate --show command to generate a key. Do not use the same key as your application.
         * The encrypter will look for the key in the environment value with the key name specified here.
        */
        'key'    => 'REST_BRIDGE_KEY'
    ],
    /*
     * The url that is listening for sql commands to return results from.
     */
    'url'        => env('REST_BRIDGE_URL'),
    'log' => [
        /*
        * Enable logging of requests, responses, and sql commands.
        */
        'enabled' => false,
        /*
         * Base path for the log files. It will create 3 log files for requests, responses, and sql queries.
         */
        'base_path' => storage_path('logs/')
    ],
    'daemon' => [
        'enabled' => false,
        'route' => '_rest_bridge/handler'
    ]
);

Example database configuration

In your database configuration the 'rest' driver will be available. It needs to know the connection you want to use., (*9)

'my-db-connection' => [
    'driver'   => 'sqlsrv',
    'host'     => env('SQLSRV_HOST', ''),
    'database' => env('SQLSRV_DATABASE', ''),
    'username' => env('SQLSRV_USERNAME', ''),
    'password' => env('SQLSRV_PASSWORD', ''),
    'charset'  => 'utf8',
    'prefix'   => '',
],
'my-rest-connection' => [
    'driver' => 'rest',
    'connection' => 'my-db-connection'
]

The rest driver will forward the configuration options to the daemon listening for commands., (*10)

The Versions

30/05 2018

dev-master

9999999-dev

A connection driver for eloquent that forwards sql statements over HTTP and returns the data back into an eloquent model.

  Sources   Download

MIT

The Requires

 

by Andrew Lamers

30/05 2018

v0.1.5

0.1.5.0

A connection driver for eloquent that forwards sql statements over HTTP and returns the data back into an eloquent model.

  Sources   Download

MIT

The Requires

 

by Andrew Lamers

21/11 2017

v0.1.4

0.1.4.0

A connection driver for eloquent that forwards sql statements over HTTP and returns the data back into an eloquent model.

  Sources   Download

MIT

The Requires

 

by Andrew Lamers

21/11 2017

v0.1.3

0.1.3.0

A connection driver for eloquent that forwards sql statements over HTTP and returns the data back into an eloquent model.

  Sources   Download

MIT

The Requires

 

by Andrew Lamers

18/11 2017

v0.1.2

0.1.2.0

A connection driver for eloquent that forwards sql statements over HTTP and returns the data back into an eloquent model.

  Sources   Download

MIT

The Requires

 

by Andrew Lamers

16/11 2017

v0.1.1

0.1.1.0

A connection driver for eloquent that forwards sql statements over HTTP and returns the data back into an eloquent model.

  Sources   Download

MIT

The Requires

 

by Andrew Lamers

16/11 2017

v0.1.0

0.1.0.0

A connection driver for eloquent that forwards sql statements over HTTP and returns the data back into an eloquent model.

  Sources   Download

MIT

The Requires

 

by Andrew Lamers