Skip to content

Instantly share code, notes, and snippets.

@sascha-egerer
Created April 24, 2015 16:47
Show Gist options
  • Save sascha-egerer/0fa5d55869c0f379d9a9 to your computer and use it in GitHub Desktop.
Save sascha-egerer/0fa5d55869c0f379d9a9 to your computer and use it in GitHub Desktop.
List CMIS Directory Content
<?php
// Install https://github.com/dkd/php-cmis-client over composer
require_once(__DIR__ . '/vendor/autoload.php');
$httpInvoker = new \GuzzleHttp\Client(
array(
'defaults' => array(
'auth' => array(
'admin',
'admin'
)
)
)
);
$parameters = array(
\Dkd\PhpCmis\SessionParameter::BINDING_TYPE => \Dkd\PhpCmis\Enum\BindingType::BROWSER,
\Dkd\PhpCmis\SessionParameter::BROWSER_URL => 'http://cmis.alfresco.com/cmisbrowser',
\Dkd\PhpCmis\SessionParameter::BROWSER_SUCCINCT => false,
\Dkd\PhpCmis\SessionParameter::HTTP_INVOKER_OBJECT => $httpInvoker,
);
$sessionFactory = new \Dkd\PhpCmis\SessionFactory();
$repositories = $sessionFactory->getRepositories($parameters);
$parameters[\Dkd\PhpCmis\SessionParameter::REPOSITORY_ID] = $repositories[0]->getId();
$session = $sessionFactory->createSession($parameters);
$rootFolder = $session->getRootFolder();
foreach ($rootFolder->getChildren() as $children) {
echo $children->getName() . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment