forked from sokil/php-merchant-product-feed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
32 lines (27 loc) · 930 Bytes
/
Copy pathexample.php
File metadata and controls
32 lines (27 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
declare(strict_types=1);
require_once __DIR__ . '/vendor/autoload.php';
use Performing\FeedBuilder\Feed;
use Performing\FeedBuilder\Formatters\GoogleFeedFormatter;
use Performing\FeedBuilder\Objects\Availability;
use Performing\FeedBuilder\Objects\Condition;
use Performing\FeedBuilder\Objects\Price;
use Performing\FeedBuilder\Objects\Product;
use Performing\FeedBuilder\Objects\Url;
use Performing\FeedBuilder\Writers\StreamWriter;
$feed = new Feed([
new Product(
'test-product-1',
'Test Product',
'This is a test product description',
Availability::InStock,
Condition::New,
new Price('19.99', 'USD'),
new Url('https://example.com/product'),
new Url('https://example.com/product.jpg'),
'Test Brand',
),
]);
$writer = new StreamWriter(fopen('php://stdout', 'w'));
$formatter = new GoogleFeedFormatter($writer);
$formatter->format($feed);