jssmntll / quotes-laravel
A Laravel wrapper package for Quotes
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/jssmntll/quotes-laravel
Requires
- php: ^8.3
- illuminate/http: ^12.0
- illuminate/support: ^12.0
This package is not auto-updated.
Last update: 2026-01-10 21:18:21 UTC
README
A Laravel package for integrates DummyJSON API
Installation
- Install the package via Composer:
composer require jssmntll/quotes-laravel
-
The package will automatically register its service provider and publish its assets.
-
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