Skip to content

upggr/documentdb-for-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Access Azure DocumentDB resources from php!

Usage :

include 'documentdb-for-php.php';
$host = 'https://yourdocumentdbaccount.documents.azure.com'; // see (1) in the screenshots bellow
$master_key = 'yourmasterkey=='; // see (2) in the screenshots bellow
$db = 'yourdbname'; // see (3) in the screenshots bellow (optional)
$db_rid = 'thedbresourceid=='; // see (4) in the screenshots bellow
$coll = 'yourcollectionname'; // see (5) in the screenshots bellow (optional)
$coll_rid = 'yourcollectionresourceid='; // see (6) in the screenshots bellow
$query = "Select * from ..."; // This is your SQL or LINQ code
querycoll($host, $db_rid, $coll_rid, $query,$apptype,$useragent,$cachecontrol,$da_date,$api_version,$master,$token,$master_key,$da_date); //The function that does the magic. All variables are defined above and in the functions file

The above code, is a working example, you do not need any other dependencies etc. Just include the file and copy paste the code replacing the variables as above. You will get back a json response with whatever you asked in the query, that simple!

currently tested for select statements, a work in progress. Sorry for not making it Object Oriented! :)

Alt text Alt text

About

Access your documentdb from Azure in php!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages