PHP code example of orisai / nette-data-sources
1. Go to this page and download the library: Download orisai/nette-data-sources 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/ */
orisai / nette-data-sources example snippets
use Orisai\DataSources\DataSource;
use Orisai\DataSources\Exception\EncodingFailure;
use Orisai\DataSources\Exception\NotSupportedType;
try {
$dataSource->encode('data', 'application/json' /* or just 'json' */); // json-encoded string
} catch (NotSupportedType $exception) {
// Requested type is not supported
$exception->getRequestedType(); // 'application/json'
$exception->getSupportedTypes(); // content types or file extensions, depending on what was requested
} catch (EncodingFailure $exception) {
// Encoding failed
}