Skip to content

Commit 3132fb1

Browse files
committed
first commit
0 parents  commit 3132fb1

File tree

275 files changed

+26596
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

275 files changed

+26596
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
composer.lock
2+
vendor/
3+
_builds/
4+
_cache/
5+
_projects/
6+
_steps/
7+
rethinkdb_data/
8+
wercker
9+

.travis.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
language: php
2+
3+
sudo: true
4+
5+
php:
6+
- 5.3
7+
- 5.4
8+
- 5.5
9+
- 5.6
10+
- 7.0
11+
- hhvm
12+
13+
matrix:
14+
allow_failures:
15+
- php: hhvm
16+
17+
cache:
18+
directories:
19+
- $HOME/.composer/cache
20+
21+
before_install:
22+
- source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
23+
- wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
24+
- sudo apt-get update
25+
- sudo apt-get install -y rethinkdb
26+
- nohup rethinkdb &
27+
- travis_retry composer self-update
28+
29+
install:
30+
- travis_retry composer update --no-interaction --prefer-source
31+
32+
script:
33+
- php vendor/bin/parallel-lint --exclude vendor .
34+
- php vendor/bin/phpcs -n --standard=PSR2 rdb/
35+
- composer test

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
PHP-RQL
2+
=======
3+
4+
A PHP client driver for the RethinkDB query language (ReQL).
5+
6+
PHP-RQL is licensed under the terms of the Apache License 2.0 http://www.apache.org/licenses/LICENSE-2.0
7+
8+
Continuous Integration
9+
-----------------------
10+
Master branch:
11+
[![master branch](https://travis-ci.org/danielmewes/php-rql.svg?branch=master)](https://travis-ci.org/danielmewes/php-rql)
12+
13+
Development branch:
14+
[![dev branch](https://travis-ci.org/danielmewes/php-rql.svg?branch=dev)](https://travis-ci.org/danielmewes/php-rql)
15+
16+
To run the tests at the command line, issue `composer install` and then `composer test` at the package root. This requires `composer` to be available in `$PATH`.
17+
18+
Documentation
19+
----------------
20+
21+
Read the PHP-RQL [API documentation](http://danielmewes.dnsalias.net/~daniel/php-rql-api/).
22+
23+
The official [JavaScript driver documentation](http://rethinkdb.com/api/javascript/) has more details on the available terms. Most examples for the JavaScript driver can be translated to PHP-RQL with few changes.
24+
25+
Example
26+
----------------
27+
28+
```php
29+
<?php
30+
// Load the driver
31+
require_once("rdb/rdb.php");
32+
33+
// Connect to localhost
34+
$conn = r\connect('localhost');
35+
36+
// Create a test table
37+
r\db("test")->tableCreate("tablePhpTest")->run($conn);
38+
39+
// Insert a document
40+
$document = array('someKey' => 'someValue');
41+
$result = r\table("tablePhpTest")->insert($document)
42+
->run($conn);
43+
echo "Insert: $result\n";
44+
45+
// How many documents are in the table?
46+
$result = r\table("tablePhpTest")->count()->run($conn);
47+
echo "Count: $result\n";
48+
49+
// List the someKey values of the documents in the table
50+
// (using a mapping-function)
51+
$result = r\table("tablePhpTest")->map(function($x) {
52+
return $x('someKey');
53+
})->run($conn);
54+
55+
foreach ($result as $doc) {
56+
print_r($doc);
57+
}
58+
59+
// Delete the test table
60+
r\db("test")->tableDrop("tablePhpTest")->run($conn);
61+
?>
62+
```
63+
64+
Release Notes
65+
----------------
66+
67+
...are available on the main website: http://php-rql.dnsalias.net
68+
69+
70+
Attributions
71+
------------
72+
* PHP-RQL uses pb4php http://code.google.com/p/pb4php/ by Nikolai Kordulla.
73+
* The API documentation is based on the official RethinkDB API documentation.
74+
* The API documentation is built using jTokenizer by Tim Whitlock (http://timwhitlock.info) and PHP Markdown by Michel Fortin (https://michelf.ca/).

composer.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "geekimo/php-rql",
3+
"type": "library",
4+
"description": "A PHP client driver for the RethinkDB query language (ReQL)",
5+
"keywords": ["rethinkdb","driver","database","reql"],
6+
"homepage": "https://github.com/Geekimo/php-rql/",
7+
"license": "Apache-2.0",
8+
"authors": [
9+
{
10+
"name": "Daniel Mewes",
11+
"email": "danielmewes@onlinehome.de",
12+
"homepage": "http://dmewes.com",
13+
"role": "Developer"
14+
},
15+
{
16+
"name": "Morgan Abraham",
17+
"email": "morgan@tramicms.net",
18+
"role": "Developer"
19+
}
20+
],
21+
"require": {
22+
"php": ">=5.3.0"
23+
},
24+
"require-dev": {
25+
"phpunit/phpunit": "~4.8",
26+
"jakub-onderka/php-parallel-lint": "dev-master",
27+
"squizlabs/php_codesniffer": "~2.5"
28+
},
29+
"autoload": {
30+
"files": ["rdb/rdb.php"],
31+
"psr-4": {
32+
"r\\": "rdb/",
33+
"r\\Tests\\": "tests/"
34+
}
35+
},
36+
"scripts": {
37+
"test": "tests/phpunit.sh"
38+
},
39+
"config": {
40+
"preferred-install": "dist",
41+
"optimize-autoloader": true,
42+
"process-timeout": 300
43+
}
44+
}

docs/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The API documentation is generated in three steps.
2+
1. Based on the documentation for RethinkDB's JavaScript driver (available from <https://github.com/rethinkdb/docs/tree/master/api/javascript>), some heuristics are automatically applied to translate examples into PHP-RQL syntax. This is done by the `jsToPhp.php` script.
3+
2. Since some terms work differently in PHP-RQL and the automatic translation isn't perfect, a patch is applied to the result of step 1. This patch is the file `php-patches.patch`.
4+
3. From the patched markdown file, an HTML page is generated by the script `mdToHtml.php`. This also applied a few additional filters on the markdown to account for aspects not currently supported by the PHP-RQL documentation system.
5+
6+
All three steps are performed automatically by the `generate.sh` script.

docs/api.css

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@charset "UTF-8";
2+
3+
a {
4+
color: #773333;
5+
}
6+
7+
h1 {
8+
font-family: Sans-Serif;
9+
background-color: #e5b0b0;
10+
padding: 0.7cm;
11+
}
12+
13+
h2 {
14+
margin-top: 2cm;
15+
font-family: Sans-Serif;
16+
background-color: #f0c0c0;
17+
padding: 0.5cm;
18+
}
19+
20+
h3 {
21+
margin-top: 1cm;
22+
font-family: Sans-Serif;
23+
background-color: #f5e0e0;
24+
padding: 0.1cm;
25+
}
26+
27+
pre.syntax {
28+
border: solid;
29+
border-width: 1px;
30+
border-color: #f5e0e0;
31+
padding: 0.1cm;
32+
color: #555555;
33+
}
34+
35+
pre.example {
36+
padding: 0.3cm;
37+
}

docs/generate.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
cat js-index.md | php5 jsToPhp.php > php-index.md
3+
cat php-patches.patch | patch php-index.md
4+
cat php-index.md | php5 mdToHtml.php > index.html

0 commit comments

Comments
 (0)