Download the PHP package ravendb/ravendb-php-client without Composer
On this page you can find all versions of the php package ravendb/ravendb-php-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ravendb/ravendb-php-client
More information about ravendb/ravendb-php-client
Files in ravendb/ravendb-php-client
Package ravendb-php-client
Short Description RavenDB PHP client
License MIT
Homepage https://github.com/ravendb/ravendb-php-client
Informations about the package ravendb-php-client
PHP client for RavenDB NoSQL Database
Installation
You can install library to your project via Composer
Releases
-
All client versions 5.2.x are fully compatible with and support RavenDB server releases 5.4 and 6.0.
- Click here to view all Releases and Changelog.
Documentation
This readme provides short examples for the following:
Getting started,
Crud example,
Query documents,
Attachments,
Time series,
Revisions,
Suggestions,
Patching,
Using classes,
PHP usage,
Working with secure server,
Running tests
For more information go to the online RavenDB Documentation.
For more information on how to use RavenDB with Laravel check out the Raven Laravel Demo Application
Getting started
-
Require the
DocumentStore
class from the ravendb package -
Initialize the document store (you should have a single DocumentStore instance per application)
-
Open a session
- Call
saveChanges()
when you're done
CRUD example
Store documents
Related tests:
Load documents
Load documents with include
Related tests:
Update documents
Delete documents
-
Using entity
- Using document ID
Related tests:
delete doc by entity
delete doc by ID
onBeforeDelete is called before delete by ID
cannot delete untracked entity
loading deleted doc returns null
Query documents
- Use
query()
session method:
Query by collection:
Query by index name:
Query by index:
Query by entity type:
-
Build up the query - apply search conditions, set ordering, etc.
Query supports chaining calls: - Execute the query to get results:
Query methods overview
selectFields() - projections using a single field
Related tests:
[query single property](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L368) [can_project_id_field](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Issues/RavenDB_14811Test/RavenDB_14811Test.php#L58)
selectFields() - projections using multiple fields
Related tests:
[query with projection](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L555) [can_project_id_field](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Issues/RavenDB_14811Test/RavenDB_14811Test.php#L58)
distinct()
Related tests:
[query distinct](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L611)
whereEquals() / whereNotEquals()
Related tests:
[where equals](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L784) [where not equals](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L817)
whereIn()
Related tests:
whereStartsWith() / whereEndsWith()
Related tests:
whereBetween()
Related tests:
[query with where between](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L438)
whereGreaterThan() / whereGreaterThanOrEqual() / whereLessThan() / whereLessThanOrEqual()
Related tests:
[query with where less than](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L463) [query with where less than or equal](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L486) [query with where greater than](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L507) [query with where greater than or equal](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L532)
whereExists()
Checks if the field exists.
Related tests:
[query where exists](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L997)
containsAny() / containsAll()
Related tests:
[queries with contains](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/ContainsTest/ContainsTest.php#L12)
search()
Perform full-text search.
Related tests:
[query search with or](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L636) [query_CreateClausesForQueryDynamicallyWithOnBeforeQueryEvent](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L35)
openSubclause() / closeSubclause()
Related tests:
[working with subclause](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/Issues/RavenDB_5669Test/RavenDB_5669Test.php#L44)
not()
Related tests:
[query where not](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L817)
orElse() / andAlso()
Related tests:
[working with subclause](https://github.com/ravendb/ravendb-nodejs-client/blob/5c14565d0c307d22e134530c8d63b09dfddcfb5b/test/Ported/Issues/RavenDB_5669.ts#L40)
usingDefaultOperator()
If neither andAlso()
nor orElse()
is called then the default operator between the query filtering conditions will be AND
.
You can override that with usingDefaultOperator
which must be called before any other where conditions.
orderBy() / orderByDesc() / orderByScore() / randomOrdering()
Related tests:
[query random order](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L817) [order by AlphaNumeric](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L1103) [query with boost - order by score](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L1026)
take()
Limit the number of query results.
Related tests:
[query skip take](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L685)
skip()
Skip a specified number of results from the start.
Related tests:
[query skip take](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/_QueryTest/QueryTest.php#L685)
Getting query statistics
Use the statistics()
method to obtain query statistics.
all() / first() / single() / count()
all()
- returns all results
first()
- first result only
single()
- first result, throws error if there's more entries
count()
- returns the number of entries in the results (not affected by take()
)
Related tests:
Attachments
Store attachments
Related tests:
[can put attachments](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/Attachments/AttachmentsSessionTest.php#L15)
Get attachments
Related tests:
[can get & delete attachments](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/Attachments/AttachmentsSessionTest.php#L144)
Check if attachment exists
Related tests:
[attachment exists 2](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/Attachments/AttachmentsSessionTest.php#L419)
Get attachment names
Related tests:
[get attachment names 2](https://github.com/ravendb/ravendb-php-client/blob/282c7bf6d2580ba446e878498d215a38caa67799/tests/Test/Client/Attachments/AttachmentsSessionTest.php#L376)
TimeSeries
Store time series
Related tests:
canCreateSimpleTimeSeries
usingDifferentTags
canStoreAndReadMultipleTimestamps
canStoreLargeNumberOfValues
shouldDeleteTimeSeriesUponDocumentDeletion
Get time series for document
Related tests:
canCreateSimpleTimeSeries
canStoreLargeNumberOfValues
canRequestNonExistingTimeSeriesRange
canGetTimeSeriesNames2
canSkipAndTakeTimeSeries
Revisions
NOTE: Please make sure revisions are enabled before trying the below.
Suggestions
Suggest options for similar/misspelled terms
Advanced patching
Related tests:
can patch
can patch complex
can add to array
can increment
patchWillUpdateTrackedDocumentAfterSaveChanges
can patch single document
Using classes for entities
-
Define your model as class. Attributes should be just public properties:
-
To store a document pass its instance to
store()
.
The collection name will automatically be detected from the entity's class name. -
Loading a document
- Querying for documents
Usage with PHP
PHP typings are embedded into the package. Make sure to close session when you finish your work with it.
Working with a secure server
Your certificate and server certificate should be saved in PEM format to your machine.
-
Create AuthOptions:
- Pass auth options to
DocumentStore
object:
Running tests
Clone the repository:
Install dependencies:
Run RavenDB server
Set environment variables.
Run PHPUnit
Bug Tracker
http://issues.hibernatingrhinos.com/issues/RDBC
License
The MIT License (MIT). Please see License File for more information.
All versions of ravendb-php-client with dependencies
ext-ds Version *
ext-json Version *
ext-zip Version *
ext-fileinfo Version *
doctrine/annotations Version ^1.13
doctrine/inflector Version ^2.0
ramsey/uuid Version ^4.2
symfony/http-client Version ^6.1
symfony/mime Version ^6.1
symfony/property-access Version ^6.1
symfony/serializer Version ^6.1