PHP code example of jamielsharief / document-store
1. Go to this page and download the library: Download jamielsharief/document-store library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jamielsharief / document-store example snippets
use DocumentStore\Document;
$document = new Document();
$document->title = 'Patterns of Enterprise Application Architecture';
$document->author = 'Martin Fowler';
$document->type = 'hardcover';
$document->isbn = [
'978-0321127426',
'0321127420'
];
use DocumentStore\Document;
$document = new Document([
'title' => 'Patterns of Enterprise Application Architecture',
'author' => 'Martin Fowler',
'type' => 'hardcover',
'isbn' => [
'978-0321127426',
'0321127420'
]
]);
$result = $store->find('first', [
'conditions' => [
'author' => ['Mark Minervini']
],
]);
/*
DocumentStore\Document Object
(
[_id] => 5f730fd6ed12968109f89d0d
[title] => Trade Like a Stock Market Wizard: How to Achieve Super Performance in Stocks in Any Market
[author] => Mark Minervini
)
*/
$result = $store->find('all', [
'conditions' => [
'author' => ['Mark Minervini']
],
'limit' => 2,
]);
/*
Array
(
[0] => DocumentStore\Document Object
(
[_id] => 5f730fd6ed12968109f89d0d
[title] => Trade Like a Stock Market Wizard: How to Achieve Super Performance in Stocks in Any Market
[author] => Mark Minervini
)
[1] => DocumentStore\Document Object
(
[_id] => 5f730fde23b43a7800f7da25
[title] => Mindset Secrets for Winning: How to Bring Personal Power to Everything You Do
[author] => Mark Minervini
)
)
*/