orisai / data-sources

从和到各种数据格式加载数据和保存数据

1.0.2 2024-06-21 09:17 UTC

This package is auto-updated.

Last update: 2024-09-21 09:45:36 UTC


README

Orisai
数据源

从和到各种数据格式加载数据和保存数据

📄 查看我们的 文档

💸 如果你喜欢Orisai,请 捐款。谢谢!

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
}