Download the PHP package chrishardie/laravel-feedmaker without Composer
On this page you can find all versions of the php package chrishardie/laravel-feedmaker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chrishardie/laravel-feedmaker
More information about chrishardie/laravel-feedmaker
Files in chrishardie/laravel-feedmaker
Package laravel-feedmaker
Short Description Laravel package to enable crawling/parsing HTML pages and generating corresponding RSS feeds
License MIT
Homepage https://github.com/chrishardie/laravel-feedmaker
Informations about the package laravel-feedmaker
Laravel Feedmaker
Laravel package to enable crawling/parsing HTML pages and generating corresponding RSS feeds
Installation
You can install the package via composer:
You can publish and run the migrations with:
You can publish the config file with:
This is the contents of the published config file:
Add a new disk to your config/filesystems.php
file, to define where the generated RSS feeds will be stored:
Then, run artisan storage:link
to make sure the storage disk is in place.
To display an index of available feeds, configure the $url
variable in the config file and add the following to your routes/web.php
file:
If you want to get notices about issues related to updating the feeds from sources, make sure you define a logging destination. For example, to receive Slack notifications, make sure LOG_SLACK_WEBHOOK_URL
is defined in .env
and then set your LOG_CHANNEL
to include a log stack that includes Slack.
Usage
There are two steps for adding a new source to be included:
- Create a new Source model. If you don't have an admin interface, you can do this via tinker:
This tells the application the basic info about your source including the PHP class that will define how to scrape/crawl it, the URL to crawl, and the human-facing name and main URL.
- Create a source class in
app/Sources/YourSource/YourSource.php
that defines agenerateRssItems()
method returning a collection of items to include in the RSS feed. Here's an example:
If you will be scraping a URL's dom via CSS or XPath selectors, you can use the scraper trait to simplify this. It handles the generateRssItems method for you, and all you have to do is define a parsse()
method that returns an RssItemCollection:
The RssItemCollection must contain the following keys for each item:
- pubDate: Carbon date object
- title: string
- url: string
- description: string
Optionally, it can also contain these keys:
- guid: a URL that will become the unique/GUID for the RSS item instead of the url
Then, you can force a check of your source and generate a corresponding feed:
$ artisan feeds:update YourSource
View the result at https://yoursite.com/feeds/yoursource.rss
An index of all generated feeds should be available at the URI defined in the config file.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Issues and Pull Requests are welcome.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-feedmaker with dependencies
fabpot/goutte Version ^4.0
masterminds/html5 Version ^2.7
spatie/laravel-package-tools Version ^1.4.3