PHP code example of subugoe / oai-model
1. Go to this page and download the library: Download subugoe/oai-model 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/ */
subugoe / oai-model example snippets
// assume we injected some service at $this->oaiService
$identify = new new \Subugoe\OaiModel\Model\Identify\Identify();
$identification = new \Subugoe\OaiModel\Model\Identify\Identification();
$description = new \Subugoe\OaiModel\Model\Identify\Description();
$oaiIdentifier = new \Subugoe\OaiModel\Model\Identify\OaiIdentifier();
$oaiIdentifierTags = $oaiConfiguration['oai_identifier'];
$oaiIdentifier
->setNamespace($oaiIdentifierTags['xmlns'])
->setXsi($oaiIdentifierTags['xmlns:xsi'])
->setSchemaLocation($oaiIdentifierTags['xsi:schemaLocation'])
->setScheme($oaiIdentifierTags['scheme'])
->setDelimiter($oaiIdentifierTags['delimiter'])
->setRepositoryIdentifier($oaiIdentifierTags['repositoryIdentifier'])
->setSampleIdentifier($oaiIdentifierTags['sampleIdentifier']);
$description->setOaiIdentifier($oaiIdentifier);
$identificationTags = $oaiConfiguration['identification_tags'];
$oaiRequest = (new \Subugoe\OaiModel\Model\Request())
->setUrl($url)
->setVerb('Identify');
$identify
->setDate(new DateTimeImmutable())
->setRequest($oaiRequest);
$identification
->setAdminEmail($identificationTags['admin_email'])
->setBaseUrl($identificationTags['base_url'])
->setDeletedRecord($identificationTags['deleted_record'])
->setGranularity($identificationTags['granularity'])
->setProtocolVersion($identificationTags['protocol_version'])
->setRepositoryName($identificationTags['repository_name'])
->setEarliestDatestamp(new DateTimeImmutable('1998-03-01T00:00:00Z'))
->setDescription($description);
$identify->setIdentify($identification);
$xml = $this->serializer->serialize($identify, 'xml');