项目作者: marklogic-community

项目描述 :
PHP Connector for MarkLogic REST API
高级语言: HTML
项目地址: git://github.com/marklogic-community/mlphp.git
创建时间: 2012-10-24T20:43:17Z
项目社区:https://github.com/marklogic-community/mlphp

开源协议:Apache License 2.0

下载


MLPHP

PHP API for MarkLogic

MLPHP is a PHP API for MarkLogic that makes it easy to store documents, manage document metadata, and create sophisticated search queries on a web server running PHP (version 5.4 or greater). The PHP classes communicate with the MarkLogic via the MarkLogic REST API.

After installing MLPHP (see below), you can load documents into
MarkLogic with just a couple lines of PHP code:

  1. use MarkLogic\MLPHP;
  2. $document = new MLPHP\Document($client);
  3. $document->setContentFile('myfile.xml')->write('/myfile.xml');

Searching is just as easy:

  1. use MarkLogic\MLPHP;
  2. $search = new MLPHP\Search($client);
  3. $results = $search->retrieve('cat');

More details are available in the examples described below.

Dependencies

Installation

To add MLPHP to your project, simply add MLPHP as a Composer requirement in composer.json:

  1. {
  2. "require": {
  3. "marklogic/mlphp" : "dev-master"
  4. }
  5. }

And then, depending on how you installed Composer, run

  1. % composer install

or

  1. % php composer.phar install

API Documentation

API docs are available online. A copy is also provided inside the MLPHP repo under api/docs.

License

MLPHP is licensed under the Apache License, Version 2.0 (see LICENSE.txt).

Status

MLPHP is in early-stage development, but ready for use. The API is subject to change.

Examples

MLPHP examples are being revised.

Development

Building

  1. % git clone git@github.com:marklogic/mlphp mlphp
  2. % cd mlphp
  3. % composer install

To generate a clean set of new API docs from source

  1. Update master branch

    1. % cd $PATH_TO_MLPHP/mlphp/api/docs
    2. % git rm -rf *
    3. % cd $PATH_TO_MLPHP/mlphp/
    4. % vendor/bin/phpdoc mlphp.ini
    5. % cd $PATH_TO_MLPHP/mlphp/api/docs
    6. % git add .
    7. % git commit -a -m "New docs"
    8. % git push origin master
  2. Update gh-pages copy (Technique borrowed from https://gist.github.com/825950)

    1. % cd $PATH_TO_MLPHP/mlphp/api

    If this is the first time,

    1. % git clone -b gh-pages \
    2. --single-branch git@github.com:marklogic/mlphp docs-ghpages

    Then…

    1. % cd $PATH_TO_MLPHP/mlphp/api/docs-ghpages
    2. % git rm -rf [a-z]*
    3. % cd $PATH_TO_MLPHP/mlphp
    4. % vendor/bin/phpdoc mlphp-ghpages.ini
    5. % cd PATH_TO_MLPHP/mlphp/api/docs-ghpages
    6. % git add .
    7. % git commit -a -m "New docs"
    8. % git push origin gh-pages

Unit tests

Unit tests can be found under tests. To run,

  1. Edit phpunit-config.php and set configuration variables specific to your MarkLogic setup.
  2. Run the tests:

    1. % vendor/bin/phpunit tests

MLPHP uses PHPUnit for testing. See the tests README.md for more.

Contributing

You can request a new feature by submitting an issue to the project’s [GitHub Issue Tracker]
(https://github.com/marklogic/mlphp/issues).

Please submit pull requests to the develop branch.

Copyright 2002-2015 MarkLogic Corporation. All Rights Reserved.