tacman/bing-news-search

PHP Library for bing news search API.

Maintainers

👁 tacman1123

Package info

github.com/tacman/BingNewsSearch

pkg:composer/tacman/bing-news-search

Statistics

Installs: 285

Dependents: 1

Suggesters: 0

Stars: 0

2.0.5 2025-01-04 01:24 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 60333b81dedc61670d73619578cf5119cf275a0c

This package is auto-updated.

Last update: 2026-06-04 04:39:54 UTC


README

Fork of https://github.com/gabriel-yuji-inoue/BingNewsSearch

This fork drops support for PHP 7 and refactors how structures are populated. It is used by the survos/bing-news-bundle.

See more of this API at: https://docs.microsoft.com/en-us/bing/search-apis/bing-news-search

Dependencies

  • PHP 8.3+
  • GuzzleHttp 7.0.x >

Instalation

composer require tacman/bing-news-search

composer config repositories.bing_news '{"type": "vcs", "url": "git@github.com:tacman/BingNewsSearch.git"}' composer require tacman/bing-news-search:dev-refactor

composer config repositories.bing_news '{"type": "path", "url": "~/g/tacman/BingNewsSearch"}' composer require tacman/bing-news-search:*@dev

Usage of Api bing NEWS microsoft an easy way

Initialize the Client instance

$client = new Client(
 'apibingurl.com.br', // https://api.bing.microsoft.com/
 'your_secret_key' // a1b2c3d4e5f6g7h8a1b2c3d4e5f6g7h8
);

Configure client

$client->enableExceptions(); // throw exceptions for debug
$client->disableSsl(); // disable Guzzle verification SSL

Search by category

// Ex: Search by business category, with pt_BR language, without safe search restriction;
$request = $client->category()
 ->get(Enum\Category::BUSINESS(), Enum\Language::PT_BR())
 ->setSafeSearch(Enum\SafeSearch::OFF())
 ->request();
$news = $request->getNews();

Search by key word

// Ex: Search by key word, limited at 50 items, with safe search restriction;
 $request = $client->search()
 ->get('something cool')
 ->setQuantity(50)
 ->setSafeSearch(Enum\SafeSearch::STRICT())
 ->request();
$news = $request->getNews();

Search by trending topics

// Ex: Get trending topics news, with en_US language.
 $request = $client->trending()
 ->get(Enum\Language::EN_US())
 ->request();
$news = $request->getTrending();

MORE

Check BingNewsSearch\Enum classes to know all avaiables search configurations, such as: Categories and SubCategories, Languages and more..