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
50 changes: 48 additions & 2 deletions config/feeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,41 @@

declare(strict_types=1);

use DragonCode\LaravelFeed\Transformers\BooleanTransformer;
use DragonCode\LaravelFeed\Transformers\DateTimeTransformer;

/**
* Laravel Feeds configuration
*
* This file defines how feeds are generated and presented, including
* formatting, persistence, scheduling, console UX and value transformers.
* Adjust the options below or override them via environment variables.
*/
return [
/**
* Pretty-print the generated feed output.
*
* When enabled, the resulting XML/JSON will include indentation and
* human‑friendly formatting. Disable for slightly smaller payload size.
*
* By default, false
* Default: false
*/
'pretty' => (bool) env('FEED_PRETTY', false),

/**
* Output format options.
*/
'formats' => [
/**
* Date/time format used when serializing timestamps to feeds.
* You may use any PHP date format constant, e.g. DATE_ATOM, DATE_RFC3339
* or a custom PHP date() format string.
*
* Default: DATE_ATOM
*/
'date' => DATE_ATOM,
],

/**
* Database table settings used by the package (e.g., for generation logs or state).
*/
Expand All @@ -22,11 +46,15 @@
*
* Should match a connection defined in config/database.php under
* the "connections" array.
*
* Default: sqlite
*/
'connection' => env('DB_CONNECTION', 'sqlite'),

/**
* The database table name used by the package.
*
* Default: feeds
*/
'table' => env('FEED_TABLE', 'feeds'),
],
Expand All @@ -40,6 +68,8 @@
*
* Controls how frequently a scheduled job may be executed to avoid
* overlapping or excessively frequent runs.
*
* Default: 1440 (24 hours)
*/
'ttl' => (int) env('FEED_SCHEDULE_TTL', 1440),

Expand All @@ -48,6 +78,8 @@
*
* When true, tasks will be dispatched to run asynchronously so they do
* not block the current process. Set to false to run in the foreground.
*
* Default: true
*/
'background' => (bool) env('FEED_SCHEDULE_RUN_BACKGROUND', true),
],
Expand All @@ -62,8 +94,22 @@
* When set to true, the feed:generate command will display a
* progress bar showing the execution progress.
*
* Default is false.
* Default: false
*/
'progress_bar' => (bool) env('FEED_CONSOLE_PROGRESS_BAR_ENABLED', false),
],

/**
* Transformers convert rich/complex values to simple scalar representations
* suitable for feeds (XML/JSON). Order matters: the first transformer that
* supports the value will handle it.
*
* You may add your own transformers by implementing
* DragonCode\LaravelFeed\Contracts\Transformer and registering the class
* here, or publish a stub via the package's make command if available.
*/
'transformers' => [
DateTimeTransformer::class,
BooleanTransformer::class,
],
];
20 changes: 10 additions & 10 deletions docs/snippets/advanced-directive-array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<array_directive>

<user>
<name>Kayley Hermann</name>
<avatar>https://via.placeholder.com/640x480.png/00aa77?text=eos</avatar>
<avatar>https://via.placeholder.com/640x480.png/00ff66?text=voluptatem</avatar>
<images name="itaque repudiandae quod">https://via.placeholder.com/640x480.png/00ee33?text=qui</images>
<images name="nemo quasi et">https://via.placeholder.com/640x480.png/005555?text=aut</images>
<name>Justen Barrows</name>
<avatar>https://via.placeholder.com/640x480.png/008877?text=reprehenderit</avatar>
<avatar>https://via.placeholder.com/640x480.png/0066aa?text=quasi</avatar>
<images name="et sed consequuntur">https://via.placeholder.com/640x480.png/00bb55?text=ab</images>
<images name="hic porro maiores">https://via.placeholder.com/640x480.png/006666?text=eum</images>
</user>
<user>
<name>Dr. Alek Stamm PhD</name>
<avatar>https://via.placeholder.com/640x480.png/0077dd?text=necessitatibus</avatar>
<avatar>https://via.placeholder.com/640x480.png/00ee00?text=nulla</avatar>
<images name="rerum voluptas est">https://via.placeholder.com/640x480.png/003377?text=id</images>
<images name="velit qui perspiciatis">https://via.placeholder.com/640x480.png/0022bb?text=necessitatibus</images>
<name>Mr. Maximo Brown DDS</name>
<avatar>https://via.placeholder.com/640x480.png/00ddaa?text=velit</avatar>
<avatar>https://via.placeholder.com/640x480.png/0000ee?text=maxime</avatar>
<images name="id officia ut">https://via.placeholder.com/640x480.png/005533?text=eos</images>
<images name="maiores excepturi rerum">https://via.placeholder.com/640x480.png/0000bb?text=ullam</images>
</user>

</array_directive>
10 changes: 5 additions & 5 deletions docs/snippets/advanced-directive-attributes.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<attributes_directive>

<company since="1979"/>
<company since="1998"/>
<url>https://example.com</url>

<user>
<name>Lila Jones</name>
<contact email="lavada04@example.org" phone="555-000-1"/>
<name>Lera Fay</name>
<contact email="vthompson@example.com" phone="555-000-1"/>
</user>
<user>
<name>Denis Hane</name>
<contact email="gibson.maynard@example.com" phone="555-000-2"/>
<name>Ernest Stanton</name>
<contact email="norwood.cronin@example.net" phone="555-000-2"/>
</user>

</attributes_directive>
8 changes: 4 additions & 4 deletions docs/snippets/advanced-directive-cdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<cdata_directive>

<user>
<name><![CDATA[<h1>Jazmyne Carroll</h1>]]></name>
<email>qcrona@example.org</email>
<name><![CDATA[<h1>Abe Jenkins</h1>]]></name>
<email>zpredovic@example.net</email>
</user>
<user>
<name><![CDATA[<h1>Prof. Aida Gusikowski</h1>]]></name>
<email>will.amber@example.org</email>
<name><![CDATA[<h1>Mr. Hayden Stokes II</h1>]]></name>
<email>blind@example.org</email>
</user>

</cdata_directive>
8 changes: 4 additions & 4 deletions docs/snippets/advanced-directive-mixed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<mixed_directive>

<user>
<name>Jana Purdy</name>
<name>Prof. Giovanni Hessel</name>
<some>
<first>Foo</first>
<second>greenfelder.karley@example.net</second>
<second>cullen.farrell@example.net</second>
</some>
</user>
<user>
<name>Brandt Bernhard</name>
<name>Dr. Remington Torphy</name>
<some>
<first>Foo</first>
<second>king.orlando@example.com</second>
<second>balistreri.erica@example.org</second>
</some>
</user>

Expand Down
8 changes: 4 additions & 4 deletions docs/snippets/advanced-directive-value.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<value_directive>

<user>
<name>Elvie Lowe I</name>
<contact type="email">zwalker@example.org</contact>
<name>Johnathan Moore MD</name>
<contact type="email">jena94@example.net</contact>
</user>
<user>
<name>Trenton Lindgren DDS</name>
<contact type="email">josefa42@example.com</contact>
<name>Kianna Schimmel I</name>
<contact type="email">garrison65@example.org</contact>
</user>

</value_directive>
2 changes: 1 addition & 1 deletion docs/snippets/advanced-element-attribute-item.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AttributeFeedItem extends FeedItem
public function attributes(): array
{
return [
'created_at' => $this->model->created_at->toDateTimeString(),
'created_at' => $this->model->created_at,
];
}
}
8 changes: 4 additions & 4 deletions docs/snippets/advanced-element-attribute.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<attribute>

<user created_at="2025-09-05 01:30:20">
<user created_at="2025-09-05T02:09:32+00:00">
<id>1</id>
<name>Jarrett Stark</name>
<name>Jeremie Legros</name>
</user>
<user created_at="2025-09-05 01:30:20">
<user created_at="2025-09-05T02:09:32+00:00">
<id>2</id>
<name>Nathan Shields</name>
<name>Regan Hauck</name>
</user>

</attribute>
4 changes: 2 additions & 2 deletions docs/snippets/advanced-element-header-footer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

<user>
<id>1</id>
<name>Miss Myrtice Durgan Jr.</name>
<name>Dr. Stuart Raynor II</name>
</user>
<user>
<id>2</id>
<name>Wayne Padberg</name>
<name>Zackery Crona</name>
</user>

</header_footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/advanced-element-info-before-false.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

<user>
<id>1</id>
<name>Earnest Bashirian Jr.</name>
<name>Austyn Hand I</name>
</user>
<user>
<id>2</id>
<name>Noemi Altenwerth III</name>
<name>Kathleen Dare</name>
</user>

</info_method>
4 changes: 2 additions & 2 deletions docs/snippets/advanced-element-info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

<user>
<id>1</id>
<name>Jaden Boehm</name>
<name>Willard Koch II</name>
</user>
<user>
<id>2</id>
<name>Adelbert Kihn</name>
<name>Aida Greenholt</name>
</user>

</info_method>
4 changes: 2 additions & 2 deletions docs/snippets/advanced-element-root.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

<user>
<id>1</id>
<name>Frances Treutel</name>
<name>Lonnie Senger</name>
</user>
<user>
<id>2</id>
<name>Mr. Brad Kirlin DDS</name>
<name>Winnifred Lang</name>
</user>

</foo>
48 changes: 24 additions & 24 deletions docs/snippets/receipt-instagram-feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,46 @@

<item>
<g:id>1</g:id>
<g:title><![CDATA[amet dolor iusto rerum]]></g:title>
<g:description><![CDATA[Qui aliquid ut vel est debitis. Eius debitis laborum temporibus corrupti commodi et. Praesentium vero eos qui voluptatibus. Suscipit ut id eius esse voluptatem rerum.]]></g:description>
<g:link>https://example.com/products/sint-dolor-omnis-doloribus-aut-numquam-aliquid-perspiciatis-doloribus</g:link>
<g:image_link>https://via.placeholder.com/640x480.png/00bbaa?text=quo</g:image_link>
<g:additional_image_link>https://via.placeholder.com/640x480.png/009988?text=nostrum</g:additional_image_link>
<g:additional_image_link>https://via.placeholder.com/640x480.png/0066dd?text=rerum</g:additional_image_link>
<g:brand>et</g:brand>
<g:title><![CDATA[id porro illum id]]></g:title>
<g:description><![CDATA[Repudiandae quis inventore ea hic ipsa dolores cum. Excepturi commodi ab eaque est quis et. Itaque et autem omnis sed est quos error.]]></g:description>
<g:link>https://example.com/products/blanditiis-incidunt-autem-officia-rerum</g:link>
<g:image_link>https://via.placeholder.com/640x480.png/0077aa?text=eius</g:image_link>
<g:additional_image_link>https://via.placeholder.com/640x480.png/00aaaa?text=fuga</g:additional_image_link>
<g:additional_image_link>https://via.placeholder.com/640x480.png/001144?text=beatae</g:additional_image_link>
<g:brand>velit</g:brand>
<g:condition>new</g:condition>
<g:availability>in stock</g:availability>
<g:price>719</g:price>
<g:sale_price>719</g:sale_price>
<g:price>466</g:price>
<g:sale_price>466</g:sale_price>
<g:item_group_id>12345</g:item_group_id>
<g:status>active</g:status>
<g:color><![CDATA[FloralWhite]]></g:color>
<g:size>24</g:size>
<g:color><![CDATA[PeachPuff]]></g:color>
<g:size>17</g:size>
<g:age_group>adult</g:age_group>
<g:material><![CDATA[dolorum]]></g:material>
<g:material><![CDATA[omnis]]></g:material>
<g:pattern><![CDATA[regular]]></g:pattern>
<g:google_product_category>1000</g:google_product_category>
<g:fb_product_category>2000</g:fb_product_category>
</item>
<item>
<g:id>2</g:id>
<g:title><![CDATA[eaque laudantium eveniet dolores]]></g:title>
<g:description><![CDATA[In temporibus debitis consequatur unde laudantium consectetur id. Cupiditate provident debitis nulla accusantium minima et minus. Dicta unde quis odio odio perspiciatis exercitationem in.]]></g:description>
<g:link>https://example.com/products/qui-et-veritatis-molestias-non-voluptatem</g:link>
<g:image_link>https://via.placeholder.com/640x480.png/00cc33?text=distinctio</g:image_link>
<g:additional_image_link>https://via.placeholder.com/640x480.png/00aa33?text=omnis</g:additional_image_link>
<g:additional_image_link>https://via.placeholder.com/640x480.png/0033ee?text=voluptatem</g:additional_image_link>
<g:brand>corporis</g:brand>
<g:title><![CDATA[rem commodi alias et]]></g:title>
<g:description><![CDATA[Qui quis quis quia et eveniet ut consequatur. Repudiandae iusto eum voluptates enim non et et. Ab officia non assumenda et sint consequatur modi.]]></g:description>
<g:link>https://example.com/products/facere-et-laboriosam-minus-impedit-sit</g:link>
<g:image_link>https://via.placeholder.com/640x480.png/00aa33?text=officiis</g:image_link>
<g:additional_image_link>https://via.placeholder.com/640x480.png/0011cc?text=quis</g:additional_image_link>
<g:additional_image_link>https://via.placeholder.com/640x480.png/0088ee?text=saepe</g:additional_image_link>
<g:brand>neque</g:brand>
<g:condition>new</g:condition>
<g:availability>in stock</g:availability>
<g:price>183</g:price>
<g:sale_price>183</g:sale_price>
<g:price>553</g:price>
<g:sale_price>553</g:sale_price>
<g:item_group_id>12345</g:item_group_id>
<g:status>active</g:status>
<g:color><![CDATA[Purple]]></g:color>
<g:size>21</g:size>
<g:color><![CDATA[MediumTurquoise]]></g:color>
<g:size>12</g:size>
<g:age_group>adult</g:age_group>
<g:material><![CDATA[unde]]></g:material>
<g:material><![CDATA[quos]]></g:material>
<g:pattern><![CDATA[regular]]></g:pattern>
<g:google_product_category>1000</g:google_product_category>
<g:fb_product_category>2000</g:fb_product_category>
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/receipt-sitemap-feed-item.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function toArray(): array
return [
'loc' => route('products.show', $this->model->slug),

'lastmod' => $this->model->updated_at->toIso8601String(),
'lastmod' => $this->model->updated_at,

'priority' => 0.9,
];
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/receipt-sitemap-feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">

<url>
<loc>https://example.com/products/quo-et-ut-eum-labore-libero-est-asperiores</loc>
<loc>https://example.com/products/quia-ea-quaerat-et-doloremque-et-animi-repudiandae-ipsa</loc>
<lastmod>2025-09-04T04:08:12+00:00</lastmod>
<priority>0.9</priority>
</url>
<url>
<loc>https://example.com/products/nemo-aperiam-vel-sit-eos-et-eos</loc>
<loc>https://example.com/products/dolorem-rerum-similique-ea-cum-eaque-omnis</loc>
<lastmod>2025-09-04T04:08:12+00:00</lastmod>
<priority>0.9</priority>
</url>
Expand Down
Loading