Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/snippets/advanced-element-split.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace App\Feeds;

use App\Models\User;
use DragonCode\LaravelFeed\Feeds\Feed;
use Illuminate\Database\Eloquent\Builder;

class AttributeFeed extends Feed
{
public function builder(): Builder
{
return User::query();
}

public function perFile(): int
{
return 100;
}

public function maxFiles(): int
{
return 10;
}
}
29 changes: 29 additions & 0 deletions docs/topics/elements.topic
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,33 @@

<code-block lang="xml" src="advanced-element-attribute.xml" />
</chapter>

<chapter title="Split files" id="split_files">
<secondary-label ref="format-xml" />
<secondary-label ref="format-rss" />
<secondary-label ref="format-json" />
<secondary-label ref="format-jsonl" />
<secondary-label ref="format-csv" />

<p>
If necessary, you can limit the number of lines output to a file, as well as the number of files themselves.
To do this, use the perFile and maxFiles functions.
</p>

<code-block lang="php" src="advanced-element-split.php" include-lines="5-" />

<p>
The methods work independently of each other.
</p>

<p>
When splitting, a sequential number will be added to the file names. For example:
</p>

<list>
<li>attribute-1.xml</li>
<li>attribute-2.xml</li>
<li>attribute-3.xml</li>
</list>
</chapter>
</topic>