A PHP-based Currency Converter tool that allows users to convert currencies using real-time exchange rates fetched from an external API. The tool is built with PHP, HTML, jQuery, AJAX, JSON, Bootstrap, CSS, and MySQL. The application is designed to provide accurate currency conversion and display results in a user-friendly interface.
Topics: php
, mysql
, blog
, ajax
, bootstrap
, jquery
, css
, currency conversion
, external api integration
, api integration
-
Clone the repository:
git clone https://github.com/yourusername/simple-currency-converter.git
-
Navigate to the project directory:
cd simple-currency-converter
-
Set up the database:
- Create a MySQL database named
image_gallery
. - Import the provided SQL file to create the necessary table:
mysql -u yourusername -p currency_converter < db/database.sql
- Create a MySQL database named
-
Update the database configuration:
- Copy
config.sample.php
toconfig.php
:cp config.sample.php config.php
- Open
config.php
and update the database configuration details.
- Copy
-
Setup API Integration:
- Obtain an API key from a currency exchange API provider (e.g., ExchangeRate-API).
- Update the
config.php
file with your API key and endpoint details.
// API configuration define('API_URL', 'https://api.exchangerate-api.com/v4/latest/'); define('API_KEY', 'your_api_key_here');
-
Directory Permission:
- If you encounter permission issues, you might need to set more permissive permissions, such as chmod 777, which grants read, write, and execute permissions to everyone:
chmod 777 assets/uploads
- Open
config.php
and update the database configuration details.
- If you encounter permission issues, you might need to set more permissive permissions, such as chmod 777, which grants read, write, and execute permissions to everyone:
-
Start the development server:
php -S localhost:8000
-
Access the application:
- Open your web browser and navigate to
http://localhost:8000
.
- Open your web browser and navigate to
Here’s a basic file structure for your simple-currency-converter application:
simple-currency-converter/
│
├── index.html
├── db/
│ └── database.sql
├── include/
│ ├── config.sample.php
│ └── db.php
├── assets/
│ ├── css/
│ │ └── style.css
│ └── js/
│ │ └── script.js
├── src/
│ ├── fetch-rates.php
│ ├── convert.php
│ └── get-currencies.php
├── README.md
└── .gitignore