承接 gallica-lupus/laravel-newsapi 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gallica-lupus/laravel-newsapi

最新稳定版本:1.0

Composer 安装命令:

composer create-project gallica-lupus/laravel-newsapi

包简介

Laravel wrapper for https://newsapi.org/

README 文档

README

Laravel wrapper for NewsAPI.org API calls. Documentation for the API can be found here

Installation

1- Require the package via Composer in your composer.json.

{
  "require": {
    "gallica-lupus/laravel-newsapi": "^1.0"
  }
}

2- Run Composer to install or update the new requirement.

$ composer install

or

$ composer update

3- Add the service provider to your app/config/app.php file

NewsAPI\NewsAPIServiceProvider::class,

4- Add the facade to your app/config/app.php file

'NewsAPI' => NewsAPI\Facades\NewsAPI::class,

5- Publish the configuration file

$ php artisan vendor:publish --provider="NewsAPI\NewsAPIServiceProvider"

6- Review the configuration file and add your key (preferably through env: 'api_key' => env('NEWSAPI_KEY') )

config/newsapi.php

Usage

Refer to the official docs as to which calls can be made and check the calls in traits under NewsAPI\Requests.

For example, get all sources (if using facade):

use NewsAPI;

...

$response = NewsAPI::sources()->all();

The above returns an object containing a sources array.

Get a top headlines by country and category:


$response = NewsAPI::topHeadlines()->get([
            'country' => 'gb',
            'category'=>'sports'
        ]);

Get all news from bbc.co.uk in English for time period from 2018-05-01 to 2018-05-04 sorted by publication date:

        $response = NewsAPI::everything()->get([
            'language' => 'en',
            'domains'=>'bbc.co.uk',
            'from' => '2018-05-01',
            'to' => ''2018-05-04,
            'sortBy' => 'publishedAt',
        ]);

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固