PHP code example of botk / core
1. Go to this page and download the library: Download botk/core 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/ */
botk / core example snippets
$options = [
'factsProfile' => [
'model' => 'SampleSchemaThing',
'modelOptions' => [
'base' => [ 'default'=> 'urn:yp:registry:' ]
],
'datamapper' => function($rawdata){
$data = array();
$data['identifier'] = $rawdata[0];
$data['homepage'] = $rawdata[1];
$data['alternateName'] = [ $rawdata[2], $rawdata[3]] ;
return $data;
},
'rawdataSanitizer' => function( $rawdata){
return (count($rawdata)==4)?$rawdata:false;
},
],
'skippFirstLine' => true,
'fieldDelimiter' => ','
];
BOTK\SimpleCsvGateway::factory($options)->run();
...
'uri' => array(
'filter' => FILTER_CALLBACK,
'options' => '\BOTK\Filters::FILTER_VALIDATE_URI',
'flags' => FILTER_REQUIRE_SCALAR
),
'base' => array(
'default' => 'urn:local:',
'filter' => FILTER_CALLBACK,
'options' => '\BOTK\Filters::FILTER_VALIDATE_URI',
'flags' => FILTER_REQUIRE_SCALAR
),
'id' => array(
'filter' => FILTER_CALLBACK,
'options' => '\BOTK\Filters::FILTER_SANITIZE_ID',
'flags' => FILTER_REQUIRE_SCALAR
),
'page' => array(
'filter' => FILTER_CALLBACK,
'options' => '\BOTK\Filters::FILTER_SANITIZE_HTTP_URL',
'flags' => FILTER_FORCE_ARRAY
),
...