Download the PHP package truncgil/finance without Composer
On this page you can find all versions of the php package truncgil/finance. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download truncgil/finance
More information about truncgil/finance
Files in truncgil/finance
Package finance
Short Description A Laravel package to integrate Truncgil Finance API
License MIT
Informations about the package finance
Truncgil Finance Laravel Package
This package allows you to easily use the Truncgil Finance API in your Laravel projects.
Features
- Easy access to currency rates, gold prices, and cryptocurrency data
- Automatic caching
- Facade support
- Error handling
- Easy configuration
Installation
Use the following command to add the package to your project:
Configuration
To configure the package, create a config/finance.php
file and add the following settings:
Usage
Fetching Data
You can fetch data by using the main class of the package:
Example Output:
Fetches the current exchange rates for all currencies.
Fetching a Specific Currency
To fetch a specific currency, you can use the getCurrency
method:
Example Output:
Fetches the data for the specified currency (e.g., USD).
Fetching Gold Prices
To fetch gold prices, you can use the getGold
method:
Example Output:
Fetches the current prices for gold types.
Fetching Cryptocurrency Data
To fetch cryptocurrency data, you can use the getCryptoCurrency
method:
Example Output:
Fetches the current data for the specified cryptocurrency (e.g., Bitcoin).
Fetching Data by Code or Name
You can use the get
method to fetch data by a specific code or name:
Example Output:
Fetches data for a specific item by its code or name.
Refreshing Data
To clear the cache and refresh the data, you can use the refreshData
method:
Example Output:
Clears the cache and fetches the latest data from the API.
Error Handling
If the API request fails, error handling is done automatically. The Log
class is used to log errors. If the throw_exceptions
setting is set to true
, an exception will be thrown.
License
This package is licensed under the MIT license.