PHPackages                             chrishardie/laravel-feedmaker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. chrishardie/laravel-feedmaker

ActiveLibrary[API Development](/categories/api)

chrishardie/laravel-feedmaker
=============================

Laravel package to enable crawling/parsing HTML pages and generating corresponding RSS feeds

v1.0.6(2y ago)234MITPHPPHP ^7.4|^8.0

Since Sep 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ChrisHardie/laravel-feedmaker)[ Packagist](https://packagist.org/packages/chrishardie/laravel-feedmaker)[ Docs](https://github.com/chrishardie/laravel-feedmaker)[ GitHub Sponsors](https://github.com/ChrisHardie)[ RSS](/packages/chrishardie-laravel-feedmaker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (9)Versions (9)Used By (0)

Laravel Feedmaker
=================

[](#laravel-feedmaker)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0508d9c9c9173e6f71e49ceb518d87cbec45143604ba499bf3fa2b3e2759c0af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63687269736861726469652f6c61726176656c2d666565646d616b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chrishardie/laravel-feedmaker)[![GitHub Tests Action Status](https://camo.githubusercontent.com/671f631403af22c732b05679505c736ec8bc1334d03c56f1d0427c75c32352fa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f63687269736861726469652f6c61726176656c2d666565646d616b65722f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/chrishardie/laravel-feedmaker/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/3bfa8ba9128fc562a1ec8c9595047de4c039ef652c952872b65ebfa5009972a7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f63687269736861726469652f6c61726176656c2d666565646d616b65722f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/chrishardie/laravel-feedmaker/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/22e935788a08773050802145d086c8b1c0e541b5f1bea597e529a176d35d3f84/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63687269736861726469652f6c61726176656c2d666565646d616b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chrishardie/laravel-feedmaker)

Laravel package to enable crawling/parsing HTML pages and generating corresponding RSS feeds

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require chrishardie/laravel-feedmaker
```

You can publish and run the migrations with:

```
php artisan vendor:publish --provider="ChrisHardie\Feedmaker\FeedmakerServiceProvider" --tag="feedmaker-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --provider="ChrisHardie\Feedmaker\FeedmakerServiceProvider" --tag="feedmaker-config"
```

This is the contents of the published config file:

```
return [
    // How often to update feeds from sources, in minutes
    'default_update_frequency' => 60,

    // Feed index web route
    'url' => '/',
];
```

Add a new disk to your `config/filesystems.php` file, to define where the generated RSS feeds will be stored:

```
    'disks' => [
        ...
        'feedmaker' => [
            'driver' => 'local',
            'root' => storage_path('app/feeds'),
            'url' => env('APP_URL').'/feeds',
            'visibility' => 'public',
        ],
        ...
    'links' => [
        ...
        public_path('feeds') => storage_path('app/feeds'),
```

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:

```
Route::feedsindex();
```

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
-----

[](#usage)

There are two steps for adding a new source to be included:

1. Create a new Source model. If you don't have an admin interface, you can do this via tinker:

```
$ artisan tinker
>>> $s = new ChrisHardie\Feedmaker\Models\Source
>>> $s->class_name = 'YourSource'
>>> $s->source_url = 'https://www.example.com/news'
>>> $s->name = 'Source Name'
>>> $s->home_url = 'https://example.com/'
>>> $s->frequency = 60
>>> $s->save();
```

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.

2. Create a source class in `app/Sources/YourSource/YourSource.php` that defines a `generateRssItems()` method returning a collection of items to include in the RSS feed. Here's an example:

```
