Skip to content

Commit e3513a2

Browse files
Merge pull request #142 from TheDragonCode/1.x
Added `split files` documentation
2 parents 4228d4c + 40dd6f3 commit e3513a2

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Feeds;
6+
7+
use App\Models\User;
8+
use DragonCode\LaravelFeed\Feeds\Feed;
9+
use Illuminate\Database\Eloquent\Builder;
10+
11+
class AttributeFeed extends Feed
12+
{
13+
public function builder(): Builder
14+
{
15+
return User::query();
16+
}
17+
18+
public function perFile(): int
19+
{
20+
return 100;
21+
}
22+
23+
public function maxFiles(): int
24+
{
25+
return 10;
26+
}
27+
}

docs/topics/elements.topic

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,33 @@
113113

114114
<code-block lang="xml" src="advanced-element-attribute.xml" />
115115
</chapter>
116+
117+
<chapter title="Split files" id="split_files">
118+
<secondary-label ref="format-xml" />
119+
<secondary-label ref="format-rss" />
120+
<secondary-label ref="format-json" />
121+
<secondary-label ref="format-jsonl" />
122+
<secondary-label ref="format-csv" />
123+
124+
<p>
125+
If necessary, you can limit the number of lines output to a file, as well as the number of files themselves.
126+
To do this, use the perFile and maxFiles functions.
127+
</p>
128+
129+
<code-block lang="php" src="advanced-element-split.php" include-lines="5-" />
130+
131+
<p>
132+
The methods work independently of each other.
133+
</p>
134+
135+
<p>
136+
When splitting, a sequential number will be added to the file names. For example:
137+
</p>
138+
139+
<list>
140+
<li>attribute-1.xml</li>
141+
<li>attribute-2.xml</li>
142+
<li>attribute-3.xml</li>
143+
</list>
144+
</chapter>
116145
</topic>

0 commit comments

Comments
 (0)