Extended documentation

This commit is contained in:
lukas committed 2026-10-16 09:04:50 +00:00
1 parent 6193b450ac
commit bb4a95e8de
2 files changed
+38 -2

No files matched your search

+22 -2
View File
@@ -29,6 +29,26 @@ $object = $retriever->getCloudObject(new IRI('coid://cloudobjects.io'));
echo $object->getLabel();
```
When no options are passed to the `ObjectRetriever`, it will initialize with default settings and no authentication, which means that it can only retrieve public triples from public objects. You can authenticate with a CloudObjects namespace (domain name) and the shared secret between this namespace and CloudObjects.
```php
use CloudObjects\SDK\ObjectRetriever;
use ML\IRI\IRI;
$retriever = new ObjectRetriever([
'auth_ns' => 'example.com',
'auth_secret' => 'YOUR_SHARED_SECRET',
]);
$object = $retriever->getCloudObject(new IRI('coid://example.com/PrivateObject'));
// Retrieve the object describing the authenticating namespace itself
$namespace = $retriever->getAuthenticatingNamespaceCloudObject();
echo $namespace->getLabel();
```
Any production usage should configure a cache; [all the caching options are documented here](docs/caching.md). Other [options are documented here](docs/options.md).
### Using the static facade
```php
@@ -36,7 +56,7 @@ use CloudObjects\SDK\ObjectRetriever;
use CloudObjects\SDK\ObjectRetrieverFacade;
use ML\IRI\IRI;
ObjectRetrieverFacade::setObjectRetriever(new ObjectRetriever());
ObjectRetrieverFacade::setObjectRetriever(new ObjectRetriever);
$object = ObjectRetrieverFacade::getCloudObject(new IRI('coid://cloudobjects.io'));
echo $object->getLabel();
@@ -50,7 +70,7 @@ The global function uses the static facade, so the facade must be initialized fi
use CloudObjects\SDK\ObjectRetriever;
use CloudObjects\SDK\ObjectRetrieverFacade;
ObjectRetrieverFacade::setObjectRetriever(new ObjectRetriever());
ObjectRetrieverFacade::setObjectRetriever(new ObjectRetriever);
$object = cloudobjects_get_object('coid://cloudobjects.io');
echo $object->getLabel();