{"id":37002567,"url":"https://github.com/tpg/bidfeed","last_synced_at":"2026-01-14T00:29:30.144Z","repository":{"id":57068425,"uuid":"192885645","full_name":"tpg/bidfeed","owner":"tpg","description":"A simple XML Feed generator for Bid or Buy South Africa","archived":true,"fork":false,"pushed_at":"2019-06-26T09:14:26.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-11T03:56:42.056Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tpg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-20T08:57:03.000Z","updated_at":"2023-01-28T05:02:26.000Z","dependencies_parsed_at":"2022-08-24T14:54:11.649Z","dependency_job_id":null,"html_url":"https://github.com/tpg/bidfeed","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/tpg/bidfeed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpg%2Fbidfeed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpg%2Fbidfeed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpg%2Fbidfeed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpg%2Fbidfeed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpg","download_url":"https://codeload.github.com/tpg/bidfeed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpg%2Fbidfeed/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406486,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T00:29:29.237Z","updated_at":"2026-01-14T00:29:30.135Z","avatar_url":"https://github.com/tpg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BidFeed\n\n[![Build Status](https://travis-ci.org/tpg/bidfeed.svg?branch=master)](https://travis-ci.org/tpg/bidfeed)\n\n__Bid or Buy XML Feed Library__\n\nBidFeed is an XML generator for the Bid or Buy XML feed.\n\n## Installation\n\nBidFeed should be installed through Composer:\n\n```bash\ncomposer require thepublicgood/bidfeed\n```\n\n## Usage\nYou'll need to `require` the Composer autoloader if you're not using a framework that does so automatically.\n\nStart by creating a new instance of `TPG\\BidFeed\\Builder`. The methods on the `Builder`.\n\n```php\nrequire __DIR__.'/vendor/autoload.php';\n\n$feed = new TPG\\BidFeed\\Builder();\n```\n\nThe `Builder` class provides a `products()` method that returns a `TPG\\BidFeed\\Collection` instance. You can add new products to the feed by pushing new instances of `TPG\\BidFeed\\Product`.\n\n```php\n$product = new Product();\n\n$feed-\u003eproducts()-\u003epush($product);\n```\n\n## Generating the XML\nAt any point, you can get a copy of the XML by calling the `toXml()` method on the `Builder` instance.\n\n```php\n$xml = $feed-\u003etoXml();\n\n// You can also save it directly to a file by passing a filename:\n$feed-\u003etoXml('feed.xml');\n```\n\nCalling the `toXml()` method does not alter the instance in any way, so you can continue to build up products even after generating an XML output.\n\nThe `toXml()` method will also call the `verifyAttributes()` method on each `Product` instance. If there is anything missing, a `MissingRequiredAttribute` exception will be thrown.\n\n## Adding Products\nYou build up a feed by adding products. The `Product` class provides a simple API for working with products.\n\nA single product is represented by an instance of `Product`. the `Builder::products()` method always returns a `Collection` instance containing a set of `Product` instances.\n\n```php\n// You can...\n$feed-\u003eproducts()-\u003epush((new Product())-\u003e...);\n\n// or add multiple products at once...\n$feed-\u003eproducts()-\u003epush([$product1, $product2]);\n```\n\n## Required Attributes\n\n```php\n$product-\u003ename($productName)\n    -\u003ecode($productCode)\n    -\u003ecategory($category)\n    -\u003eprice($price, $marketPrice)\n    -\u003eavailableQuantity($quantity)\n    -\u003edescription($description);\n```\n\nSome attributes are generally not required unless the product needs to appear in Google Ads posted by Bid or Buy, then these attributes MUST be supplied:\n\n```php\n$product-\u003egtin($productGtin)        // GTIN (GTIN-12 or GTIN-13)\n    -\u003empn($mpn);                    // MPN\n```\n\nA number of attributes are required. All products must have a name, a product code, a category, price, quantity, and description. If any of these attributes are missing on a single product, a `MissingRequiredAttribute` exception will be thrown.\n\n## Setting a product code\n\nA product MUST have a unique product code and it cannot change. Any duplicate product codes will be ignored an the product will not be imported. The product code has a maximum length of 100 characters.\n\n```php\n$product-\u003ecode('CODE-000111');\n```\n\n## Setting a product name\nAll products must be named. You can specify the product name using the `name` method. Product names cannot be longer than 100 characters:\n\n```php\n$product-\u003ename('My Product');\n```\n\n## Setting a description\nThe description of the product should include the details of the product. It cano be upto 8000 characters long and can include some limited HTML. The BidFeed library currently allows `P` and `BR` html elements.\n\n```php\n$product-\u003edescription('\u003cp\u003eProduct description\u003c/p\u003e');\n```\n\n## Setting a category\nA product category must be supplied with app products and preferably based on Google's taxonomy. See [https://support.google.com/merchants/answer/6324436](). It's recommended that the full category path be specified. The `category` method accepts an array of category names. So if the category should be `Electroncis - Laptops - Apple` you can do:\n\n```php\n$product-\u003ecategory(['Electronics', 'Laptops', 'Apple']);\n```\n\n## Setting Price\nAll products MUST have a price set. There are two prices that a product can have. The actual selling price, which is required, and a market price, which is optional. The market price is only for reference and not used as a selling price in any way.\n\nYou can set both prices by passing the selling price, and the market price at floats to the `price()` method, or set the market price separately using the `marketPrice()` method.\n\n```php\n// Set a selling price\n$product-\u003eprice(199.95);\n\n// Set a selling price and market price\n$product-\u003eprice(199.95, 219.95);\n\n// Set a marketing price\n$product-\u003emarketPrice(211.50);\n```\n\n## Available Quantity\nBid or Buy require that an available quantity be specified. You can specify the quantities using the `availableQuantity()` method. Any product with a quantity of 0 will not be imported.\n\n```php\n$product-\u003eavailableQuantity(10);\n```\n\n## Product Images\nImages must included with all products. At least one image must be provided. You can provide more than one, but only the first image will be used as the product cover image. Images are displayed by Bid or Buy in the order they are provided.\n\nYou can provide a set of image URLs by passing an array to the `images()` method.\n\n```php\n$product-\u003eimages([$image1, $image2]);\n```\n\nImages are stored as a `Collection` instance. You can get to the instance using the `imageCollection()` method.\n\n```php\n// Add an image to the collection\n$product-\u003eimageCollection()-\u003eadd($imageUrl3);\n```\n\n## Product Attributes\nProducts can have an optional set of custom attributes. It's common to add a `Brand` attribute here, but you can add any attributes needed. According to the Bid or Buy feed spec, attributes that do not match marketplace values are ignored, so you should only add attributes that are category specific.\n\n```php\n$product-\u003eproductAttributes([\n    'Brand' =\u003e 'Apple'\n]);\n```\n\n## Guarantees and Warranties\nProducts can have a gaurantee and/or a warranty set. You can set gaurantees using the `guarantee` method, and warranties can be set using the `warranty` method. The signature for both methods is identical:\n\n```php\n$product-\u003eguarantee($type, $text);\n$product-\u003ewarranty($type, $text);\n```\n\nBidFeed provides a set of constants for gaurantee and warranty types:\n\n```php\nGUARANTEE_NOT_OFFERED;      // No guarantee\nGUARANTEE_MONEY_BACK_7;     // 7 day money back guarantee\nGUARANTEE_MONEY_BACK_10;    // 10 day\nGAURANTEE_MONEY_BACK_15;    // 15 day\nGUARANTEE_MONEY_BACK_30;    // 30 day\nGUARANTEE_REPLACEMENT_7;    // 7 day replacement guarantee\nGUARANTEE_REPLACEMENT_10;   // 10 day\nGAURANTEE_REPLACEMENT_15;   // 15 day\nGUARANTEE_REPLACEMENT_30;   // 30 day\n\nWARRANTY_NOT_OFFERED;       // No warranty\nWARRANTY_REPLACEMENT;       // Replacement warranty\nWARRANTY_DEALER;            // Dealers warranty\nWARRANTY_MANUFACTURER;      // Manufacturers warranty\n```\n\nThe second parameter allows you to specify more detail around the guarantee or warranty. The text MUST be provided if the first parameter is anything but `GUARANTEE_\n\n\n## Shipping Class\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpg%2Fbidfeed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpg%2Fbidfeed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpg%2Fbidfeed/lists"}