geekimo / php-rql
RethinkDB查询语言(ReQL)的PHP客户端驱动程序
3.0.0
2024-09-10 19:51 UTC
Requires
- php: ^8.3.0
Requires (Dev)
- jakub-onderka/php-parallel-lint: dev-master
- phpunit/phpunit: ~4.8
- squizlabs/php_codesniffer: ~2.5
This package is auto-updated.
Last update: 2024-09-10 19:56:58 UTC
README
RethinkDB查询语言(ReQL)的PHP客户端驱动程序。
PHP-RQL遵循Apache License 2.0条款 https://apache.ac.cn/licenses/LICENSE-2.0
持续集成
在命令行运行测试,请先执行 composer install
,然后在包根目录下执行 composer test
。这需要在 $PATH
中可访问 composer
。
文档
阅读PHP-RQL的API文档。
官方的JavaScript驱动程序文档提供了更多关于可用术语的详细信息。大多数JavaScript驱动程序的示例可以通过少量修改转换为PHP-RQL。
示例
<?php // Load the driver require_once("rdb/rdb.php"); // Connect to localhost $conn = r\connect('localhost'); // Create a test table r\db("test")->tableCreate("tablePhpTest")->run($conn); // Insert a document $document = array('someKey' => 'someValue'); $result = r\table("tablePhpTest")->insert($document) ->run($conn); echo "Insert: $result\n"; // How many documents are in the table? $result = r\table("tablePhpTest")->count()->run($conn); echo "Count: $result\n"; // List the someKey values of the documents in the table // (using a mapping-function) $result = r\table("tablePhpTest")->map(function($x) { return $x('someKey'); })->run($conn); foreach ($result as $doc) { print_r($doc); } // Delete the test table r\db("test")->tableDrop("tablePhpTest")->run($conn); ?>
发行说明
...可在主网站上找到: http://php-rql.dnsalias.net
贡献
- PHP-RQL使用了Nikolai Kordulla的pb4php http://code.google.com/p/pb4php/。
- API文档基于官方RethinkDB API文档。
- API文档使用Tim Whitlock的jTokenizer构建(http://timwhitlock.info)以及Michel Fortin的PHP Markdown(https://michelf.ca/)。