Search by

allnewsapi / allnewsapi

allnewsapi

PHP SDK for AllNewsAPI - a news aggregation REST API

Package info

github.com/AllNewsAPI/sdks

Language:Java

pkg:composer/allnewsapi/allnewsapi

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-10-14 04:57 UTC

This package is auto-updated.

Last update: 2026-10-14 04:57:41 UTC


README

CI

Official SDKs for the AllNewsAPI — a news aggregation REST API providing search, headlines, and usage endpoints across 50,000+ sources worldwide.

Architecture

This monorepo contains 6 language SDKs, each providing a consistent interface to the AllNewsAPI:

SDK Directory Package
Python python-sdk/ pip install allnewsapi
TypeScript javascript-sdk/ npm install allnewsapi
Go go-sdk/ go get github.com/AllNewsAPI/sdks/go-sdk
Java java-sdk/ Maven Central
PHP php-sdk/ composer require allnewsapi/allnewsapi
Ruby ruby-sdk/ gem install allnewsapi

All SDKs share the same design principles:

  • Zero external dependencies (stdlib HTTP only)
  • Three methods: search, headlines, usage
  • Typed request/response interfaces
  • Consistent error handling with status codes and messages

Quick Start

Python

pip install allnewsapi
from allnewsapi import NewsAPI

client = NewsAPI("your-api-key")
response = client.search(q="artificial intelligence", lang=["en"], max=10)

for article in response.articles:
    print(article.title)

TypeScript

npm install allnewsapi
import { NewsAPI } from 'allnewsapi';

const client = new NewsAPI('your-api-key');
const response = await client.search({ q: 'artificial intelligence', lang: ['en'], max: 10 });

for (const article of response.articles) {
  console.log(article.title);
}

Go

go get github.com/AllNewsAPI/sdks/go-sdk
package main

import (
    "fmt"
    newsapi "github.com/AllNewsAPI/sdks/go-sdk"
)

func main() {
    client := newsapi.NewClient("your-api-key")
    response, err := client.Search(newsapi.SearchOptions{
        Q:   "artificial intelligence",
        Lang: []string{"en"},
        Max:  10,
    })
    if err != nil {
        panic(err)
    }
    for _, article := range response.Articles {
        fmt.Println(article.Title)
    }
}

Java

<dependency>
    <groupId>com.allnewsapi.com</groupId>
    <artifactId>allnewsapi</artifactId>
    <version>0.1.0</version>
</dependency>
import com.allnewsapi.NewsAPI;
import com.allnewsapi.SearchOptions;
import com.allnewsapi.SearchResponse;

NewsAPI client = new NewsAPI("your-api-key");
SearchResponse response = client.search(
    new SearchOptions.Builder()
        .q("artificial intelligence")
        .lang("en")
        .max(10)
        .build()
);

for (var article : response.getArticles()) {
    System.out.println(article.getTitle());
}

PHP

composer require allnewsapi/allnewsapi
use AllNewsAPI\NewsAPI;

$client = new NewsAPI('your-api-key');
$response = $client->search([
    'q' => 'artificial intelligence',
    'lang' => ['en'],
    'max' => 10,
]);

foreach ($response['articles'] as $article) {
    echo $article['title'] . "\n";
}

Ruby

gem install allnewsapi
require 'allnewsapi'

client = AllNewsAPI::Client.new('your-api-key')
response = client.search(q: 'artificial intelligence', lang: ['en'], max: 10)

response['articles'].each do |article|
  puts article['title']
end

Features

  • Full API coverage — search, headlines, and usage endpoints with all query parameters
  • Zero external dependencies — each SDK uses only stdlib HTTP (urllib, fetch, net/http, HttpURLConnection, curl, net/http)
  • Typed interfaces — dataclasses, TypeScript interfaces, Go structs, Java classes for IDE autocompletion
  • Automated releases — Release-Please manages versioning and changelogs per SDK

Contributing

See CONTRIBUTING.md for development setup, commit conventions, and PR guidelines.

License

MIT