lushidev / foot-api
受gramma足球包启发的laraval足球API包
dev-main
2022-04-05 15:53 UTC
Requires
- guzzlehttp/guzzle: 7.4.x-dev
This package is not auto-updated.
Last update: 2024-10-02 03:37:46 UTC
README
介绍
此包是受grammar包的启发,于2022年3月挑战月期间设计,挑战要求开发一个实时比分应用。为了学习laravel技术的新知识,我决定创建一个laravel包,通过 足球API 搜索足球数据
安装
composer require lushidev/Foot-api
在app.php中发布
为了使用此包,建议在您的laravel应用程序的Config目录下的app.php文件中注册 服务提供者
和 外观
如下:
- 在服务提供者表中
Lushidev\FootApi\FootballServiceProvider::class
- 在外观表中
'Football'=>"Lushidev\FootApi\Facades\FootballFacade::class"
环境变量
FOOTBALL_API_URL=https://v3.football.api-sports.io
RAPID_URL_HOST=v3.football.api-sports.io
APIFOOTBALL_API_KEY=
在环境变量APIFOOTBALL_API_KEY中,添加您从api-football网站收到的API密钥
项目正在开发中
使用示例
<?php
use Illuminate\Support\Facades\Route;
use Lushidev\FootApi\Facades\FootballFacade;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
*/
//Route::get('/', function () {
return view('welcome');
});
/** this route returns all live matches **/
Route::get("live", function(){
return Football::getlive();
}) ;
要求
- guzzlehttp/guzzle:7.4.x
- php 8