jpcaparas/randopedia

Fetch random articles from Wikipedia

1.0.1 2023-08-20 07:23 UTC

This package is auto-updated.

Last update: 2024-10-20 10:14:00 UTC


README

Randopedia is a simple PHP library that fetches random articles from Wikipedia using their REST API.

Features

  • Fetch multiple random articles in parallel.
  • Blacklist mechanism to avoid fetching articles based on specific keywords.
  • Integration with Wikipedia's REST API.

Installation

composer require jpcaparas/randopedia

Usage

use JPCaparas\Randopedia\Fetcher;

$fetcher = new Fetcher();
$articles = $fetcher->fetchRandomArticles(5, ['exclude_keyword1', 'exclude_keyword2']);

Tests

Running Integration Tests

Integration tests will hit the live Wikipedia API. To run the integration tests:

vendor/bin/phpunit --testsuite Integration

Please note: Running integration tests frequently may hit rate limits.