PHPackages                             chkm8/laravel-rethinkdb - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. chkm8/laravel-rethinkdb

ActiveLibrary[Database &amp; ORM](/categories/database)

chkm8/laravel-rethinkdb
=======================

RethinkDB adapter for Laravel

03PHP

Since Aug 7Pushed 1y agoCompare

[ Source](https://github.com/chkm8/laravel-rethinkdb)[ Packagist](https://packagist.org/packages/chkm8/laravel-rethinkdb)[ RSS](/packages/chkm8-laravel-rethinkdb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

laravel-rethinkdb
=================

[](#laravel-rethinkdb)

[![Total Downloads](https://camo.githubusercontent.com/6d897a6d088b58c3ced1a2574b2a9f74dd23cf5990253da37b0846a2463d35db/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64757865742f6c61726176656c2d72657468696e6b64622e7376673f7374796c653d666c6174)](https://packagist.org/packages/duxet/laravel-rethinkdb)[![MIT License](https://camo.githubusercontent.com/f4b14e5a00ce76ec6aa1a758eaad4bc67f6cefc40ae66c9fd573e8c1387c4d0f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f64757865742f6c61726176656c2d72657468696e6b64622e7376673f7374796c653d666c6174)](https://packagist.org/packages/duxet/laravel-rethinkdb)[![Build Status](https://camo.githubusercontent.com/c05ee4ba8c1e84d4474b5c0a3ebe837ecd44a0b0ed14ea73b31c47bf15ef6005/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f64757865742f6c61726176656c2d72657468696e6b64622f6d61737465722e7376673f7374796c653d666c6174)](https://travis-ci.org/duxet/laravel-rethinkdb)[![Coverage Status](https://camo.githubusercontent.com/5cd4515683d22c497bcb55db981a90980cd06f719922e6f5d802484dab03c6a2/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f636f7665726167652f6769746875622f64757865742f6c61726176656c2d72657468696e6b64622e7376673f7374796c653d666c6174)](https://codeclimate.com/github/duxet/laravel-rethinkdb)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/026112a4b2375c5cf45248947eb31daec69ae7bd5411e9f0c0d43b0d9993b0e2/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f64757865742f6c61726176656c2d72657468696e6b64622f6d61737465722e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/duxet/laravel-rethinkdb/)

RethinkDB adapter for Laravel (with Eloquent support)

God bless [@jenssegers](https://github.com/jenssegers) for his great [laravel-mongodb](https://github.com/jenssegers/laravel-mongodb) project. I have used his tests and some other code, since it's awesome codebase for supporting other NoSQL databases. I hope he won't be angry on me for that ;)

Installation
============

[](#installation)

Requirements.
-------------

[](#requirements)

1. RethinkDB: You need to make sure that you have installed [RethinkDB](http://www.rethinkdb.com) successfully, you can reffer to rethinkdb [documentation](https://rethinkdb.com/docs/) for the full instruction of how to install RethinkDB.
2. Laravel 5.2: this package was designed to work with [Laravel](http://laravel.com) 5.2, so it will not work with laravel 4.x.

Installation
------------

[](#installation-1)

To fully install this package you will have either to add it manually to your `composer.json` file, or you can execute the following command :

`composer require "duxet/laravel-rethinkdb:dev-master"`

This will install the package and all the required package for it to work.

Service Provider
----------------

[](#service-provider)

After you install the library you will need to add the `Service Provider` file to your `app.php` file like :

```
duxet\Rethinkdb\RethinkdbServiceProvider::class,
```

inside your `providers` array.

Database configuration
----------------------

[](#database-configuration)

Now that you have the service provider setup, you will need to add the following configuration array at the end of your database connections array like :

```
'rethinkdb' => [
    'name'      => 'rethinkdb',
    'driver'    => 'rethinkdb',
    'host'      => env('DB_HOST', 'localhost'),
    'port'      => env('DB_PORT', 28015),
    'database'  => env('DB_DATABASE', 'homestead'),
]
```

After you add it, you can just configure your enviroment file to be something like :

```
DB_HOST=localhost
DB_DATABASE=homestead
DB_CONNECTION=rethinkdb

```

but you can always updatr your `DB_HOST` to point to the IP where you have installed RethinkDB.

Migration
=========

[](#migration)

Create a Migration File
-----------------------

[](#create-a-migration-file)

You can easily create a migration file using the following command which will create a migration file for you to create the users table and use the package schema instead of Laravel schema:

`php artisan make:rethink-migration Users --create`

Please note that you can use the same options that you use in `make:migration` with `make:rethink-migration`, as its based on laravel `make:migration`

Be aware that Laravel Schema API is not fully implemented. For example, ID columns using increments will not be auto-incremented unsigned integers, and will instead be a UUID unless explicitly set. The easiest solution is to maintain UUID use within RethinkDB, turn off incremental IDs in Laravel, and finally implement UUID use in Laravel.

Running The Migrations
----------------------

[](#running-the-migrations)

Nothing will change here, you will keep using the same laravel commands which you are used to execute to run the migration.

Example of Laravel Users Migration file
---------------------------------------

[](#example-of-laravel-users-migration-file)

This is an example of how the laravel Users Migration file has become

```
