jssmntll/quotes-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

jssmntll/quotes-laravel

最新稳定版本:v0.0.1

Composer 安装命令:

composer require jssmntll/quotes-laravel

包简介

A Laravel wrapper package for Quotes

README 文档

README

A Laravel package for integrates DummyJSON API

Installation

  1. Install the package via Composer:
composer require jssmntll/quotes-laravel
  1. The package will automatically register its service provider and publish its assets.

  2. Publish the configuration file:

php artisan vendor:publish --tag=quotes

Configuration

After publishing the configuration file, you can find it at config/quotes.php. Here you can configure:

return [
    'url' => env('QUOTES_API_URL', 'https://dummyjson.com'),
    'max_requests' => env('QUOTES_MAX_REQUESTS'),
    'time_window' => env('QUOTES_TIME_WINDOW'),
    'time_before_next_request' => env('QUOTES_TIME_BEFORE_NEXT_REQUEST'),
];

To ensure the configuration works correctly, you need to add the following environment variables to your main .env file located in the root of your project:

QUOTES_API_URL=https://dummyjson.com
QUOTES_MAX_REQUESTS=
QUOTES_TIME_WINDOW=
QUOTES_TIME_BEFORE_NEXT_REQUEST=

QUOTES_MAX_REQUESTS

Sets the maximum number of requests that can be made to the API in a given period of time.

QUOTES_TIME_WINDOW

Defines the period of time (in seconds) during which a specific number of requests, as defined by max_requests, are allowed to be made.

QUOTES_TIME_BEFORE_NEXT_REQUEST

Specifies the amount of time (in seconds) that must elapse before another request can be made to the API after the max_requests limit has been reached.

Basic Usage

Run the application

php artisan serve

Access the application in your browser

Open http://localhost:8000 in your web browser.

Using the API

The package exposes the following API endpoints:

GET /api/quotes              # Get paginated quotes
GET /api/quotes/{id}         # Get a specific quote
GET /api/quotes/random       # Get a random quote

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-21