1. Go to this page and download the library: Download vamischenko/xmlfeeds 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/ */
// Бросает ValidationException при первой ошибке (по умолчанию)
$builder->withValidation(throw: true)->build();
// Логирует ошибки, XML всё равно возвращается
$builder->withValidation(throw: false)->build();
// Только генерация, без валидации
$builder->withoutValidation()->build();
// Dry-run: получить ValidationResult без исключений
$result = $builder->validate();
if (!$result->isValid()) {
print_r($result->errors());
}
final class MyPlatform extends AbstractRssPlatform
{
public function namespace(): array { return []; }
public function return null; }
public function transform(FeedItem $item): array { return $item->toArray(); }
}