PHPackages                             dkuzmenchuk/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. dkuzmenchuk/laravel-rethinkdb

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

dkuzmenchuk/laravel-rethinkdb
=============================

RethinkDB adapter for Laravel

3.0.10(9y ago)21911[2 issues](https://github.com/dkuzmenchuk/laravel-rethinkdb/issues)1MITPHPPHP &gt;=5.5.0

Since Dec 22Pushed 9y ago2 watchersCompare

[ Source](https://github.com/dkuzmenchuk/laravel-rethinkdb)[ Packagist](https://packagist.org/packages/dkuzmenchuk/laravel-rethinkdb)[ RSS](/packages/dkuzmenchuk-laravel-rethinkdb/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (10)Versions (17)Used By (1)

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

[](#laravel-rethinkdb)

[![Total Downloads](https://camo.githubusercontent.com/817983ec595b3401685e2e8fd26aaa556dfca62e399bd3f06aa15b0802592e39/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646b757a6d656e6368756b2f6c61726176656c2d72657468696e6b64622e7376673f7374796c653d666c6174)](https://packagist.org/packages/dkuzmenchuk/laravel-rethinkdb)[![MIT License](https://camo.githubusercontent.com/dec50df4f297728dc882279b8c5639886336349570d3deab07983c8624c74c08/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f646b757a6d656e6368756b2f6c61726176656c2d72657468696e6b64622e7376673f7374796c653d666c6174)](https://packagist.org/packages/dkuzmenchuk/laravel-rethinkdb)[![Build Status](https://camo.githubusercontent.com/e7d9706b7f572e3d1ffadccbddea37220f80c9cb52e8830eaa1fde45e91df540/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f646b757a6d656e6368756b2f6c61726176656c2d72657468696e6b64622f6d61737465722e7376673f7374796c653d666c6174)](https://travis-ci.org/dkuzmenchuk/laravel-rethinkdb)[![Coverage Status](https://camo.githubusercontent.com/25c22a9f9a1f24a1d494bd1971a0f688187079374f188d774ff2ca04572c2dc8/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f636f7665726167652f6769746875622f646b757a6d656e6368756b2f6c61726176656c2d72657468696e6b64622e7376673f7374796c653d666c6174)](https://codeclimate.com/github/dkuzmenchuk/laravel-rethinkdb)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/052a89fec7f23ec98345440e119680e840c221fd9ca06342815a3f733291525e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f646b757a6d656e6368756b2f6c61726176656c2d72657468696e6b64622f6d61737465722e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/dkuzmenchuk/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 ;)

This project is aiming at Laravel 5 which is soon to be released, so it might not work with L4.

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 "dkuzmenchuk/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 :

`dkuzmenchuk\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

```
