Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bukarinevg/currency-converter-university-project
Currency converter in native php
https://github.com/bukarinevg/currency-converter-university-project
Last synced: 17 days ago
JSON representation
Currency converter in native php
- Host: GitHub
- URL: https://github.com/bukarinevg/currency-converter-university-project
- Owner: bukarinevg
- Created: 2019-11-15T00:56:57.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-16T22:43:48.000Z (about 1 year ago)
- Last Synced: 2025-01-22T11:17:55.730Z (17 days ago)
- Language: PHP
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Copy code
# PHP Currency Conversion ProjectThis PHP project focuses on currency conversion utilizing an `InfoValute` class to fetch currency information from the [CBR Daily JSON API](https://www.cbr-xml-daily.ru/daily_json.js). Additionally, it involves an `InfoUserClass` that gathers user input regarding currencies and amounts, with the main controller class `ChangeClass` performing the actual currency conversion.
## Project Overview
The primary objective of this project is to provide a simple yet functional currency conversion system leveraging external API data and user-provided information. It consists of three main classes:
### InfoValute Class
- `InfoValute` is responsible for fetching live currency exchange rates from the [CBR Daily JSON API](https://www.cbr-xml-daily.ru/daily_json.js).
- It utilizes PHP's `file_get_contents` to retrieve data from the external API and decodes the JSON response for further usage.### InfoUserClass
- `InfoUserClass` collects and stores user-specific information related to currency conversion.
- Users provide their the currency they wish to convert from, the currency to convert to, and the amount to be converted.### ChangeClass - Main Controller
- `ChangeClass` functions as the main controller class responsible for executing the currency conversion.
- It utilizes data fetched by `InfoValute` and user information from `InfoUserClass` to perform the actual currency conversion calculations.## How to Use
### Setup Instructions
1. Clone the repository to your local environment.
```bash
git clone https://github.com/your-username/currency-conversion.git
```2. Ensure you have PHP installed on your system and that it supports fetching data from external URLs.
3. Review the `InfoValute`, `InfoUserClass`, and `ChangeClass` files for clarity on functionality and implementation details.
### Usage
1. Create an instance of `InfoUserClass` by providing user-specific currency conversion details.
2. Utilize the `ChangeClass::convertCurrency()` method, passing the user object to perform the conversion.