PHPackages                             baraveli/rss-scraper - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. baraveli/rss-scraper

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

baraveli/rss-scraper
====================

Rss Scraper to scrap rss from dhivehi news sites

v1.3(5y ago)7243MITPHPCI failing

Since Dec 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/baraveli/rss-scraper)[ Packagist](https://packagist.org/packages/baraveli/rss-scraper)[ RSS](/packages/baraveli-rss-scraper/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (3)Versions (9)Used By (0)

Rss scraper
===========

[](#rss-scraper)

[![Build Status](https://camo.githubusercontent.com/cc9f0524844ad162437ad43d55d7546a9369ad56f915663e0cd4c7945417709d/68747470733a2f2f7472617669732d63692e6f72672f6261726176656c692f7273732d736372617065722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/baraveli/rss-scraper)[![Latest Stable Version](https://camo.githubusercontent.com/972f243045f826e6ba86b010a7f4fd5edfc889ff1eb9111da4c68db202c07f72/68747470733a2f2f706f7365722e707567782e6f72672f6261726176656c692f7273732d736372617065722f762f737461626c65)](https://packagist.org/packages/baraveli/rss-scraper)[![License](https://camo.githubusercontent.com/e34d798675d82e5e365d18649c3ea0b822e990d20f122b7fca2da1ac380f9c6c/68747470733a2f2f706f7365722e707567782e6f72672f6261726176656c692f7273732d736372617065722f6c6963656e7365)](https://packagist.org/packages/baraveli/rss-scraper)

[![Rss Scraper logo](https://camo.githubusercontent.com/6ccf5db977a5a56f9f0140cabf781db788a7c07d521a5b783d42d69cdb0ddbe4/68747470733a2f2f6a696e61732e6d652f696d616765732f6261726176656c697273736769746875622e6a7067)](https://camo.githubusercontent.com/6ccf5db977a5a56f9f0140cabf781db788a7c07d521a5b783d42d69cdb0ddbe4/68747470733a2f2f6a696e61732e6d652f696d616765732f6261726176656c697273736769746875622e6a7067)Rss Scraper to scrap rss feed from news websites.

🚀 Installation
--------------

[](#rocket-installation)

```
composer require baraveli/rss-scraper
```

Usage
-----

[](#usage)

To use this package when you install it be sure to create a config.json file inside your application and specify the sites you want to index.

📡 Rss Scraper Specs
-------------------

[](#satellite-rss-scraper-specs)

This documentation decribe the rss scraper structure,usage and how the individual components work in the libary.

🔮 General Explanation
---------------------

[](#crystal_ball-general-explanation)

The rss scraper get the rss feed of the news from the configuration and get the rss feed items and return the data as a json response or an array.

- ### 🔨 Config loader

    [](#hammer-config-loader)

Rss scraper configurations are stored in the configs directory as `config.json` file. The config file has the information about the rss feeds that the rss scraper calls to scrap the rss feed.

Example config:

```
{
    "mihaaru":"https://mihaaru.com/rss",
    "vaguthu" "https://vaguthu.mv/feed"
}
```

This configuration file is loading the rss feed of [mihaaru](mihaaru.com) and [vaguthu](vaguthu.mv).

Thats pretty much it for the configuration file. Rss scraper has a util `ConfigLoader` class to load configuration data from the configs directory and return the rss feed url as an array.

The ConfigLoader class has one static load method which takes a `filename` as an argument to the method as a string. filename will be the name of the json file inside the configs directory. In this case the file name will be config. If a given file is not found load method throws an execption saying "Error reading the config file or it is empty."

Config loader class is shown below:

```
