Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MiguelNavas19/miapibcv/llms.txt
Use this file to discover all available pages before exploring further.
System Requirements
Before installing Mi API BCV, ensure your system meets these requirements:Required
- PHP: 8.2 or higher
- Composer: Latest version (2.x)
- Database: One of the following:
- SQLite 3.8.8+ (default, easiest setup)
- MySQL 5.7+ / MariaDB 10.3+
- PostgreSQL 10.0+
- PHP Extensions:
- BCMath
- Ctype
- cURL
- DOM
- Fileinfo
- JSON
- Mbstring
- OpenSSL
- PCRE
- PDO
- Tokenizer
- XML
Recommended
- Git: For cloning and version control
- Node.js & NPM: If you plan to customize frontend assets
- Redis: For better cache performance (optional)
- Supervisor: For queue workers in production (optional)
Checking PHP Requirements
If you’re missing extensions, install them using your system’s package manager (apt, yum, brew, etc.).
Installation Steps
Clone the Repository
Clone the Mi API BCV repository to your local machine:Alternatively, download and extract the ZIP file if not using Git.
Install PHP Dependencies
Use Composer to install all required PHP packages:This installs:
- Laravel 12 framework
- Symfony DomCrawler for web scraping
- Symfony CSS Selector for HTML parsing
- Laravel Sanctum for API authentication
- Other Laravel dependencies
The first installation may take a few minutes depending on your internet connection.
Create Environment File
Copy the example environment file:This creates your
.env configuration file with default settings.Generate Application Key
Generate a unique application encryption key:This updates the
APP_KEY in your .env file. This key is used for:- Session encryption
- Password hashing
- Data encryption
Configure Database
Option A: SQLite (Recommended for Development)Create the SQLite database file:Verify Option B: MySQLCreate a MySQL database:Update Option C: PostgreSQLCreate a PostgreSQL database:Update
.env settings:.env:.env:Run Database Migrations
Create all necessary database tables:This creates:
reference_records- Stores exchange rate datacache- Stores cached responsescache_locks- Handles cache lockingjobs- Manages queue jobsjob_batches- Tracks batch jobsfailed_jobs- Logs failed queue jobssessions- Stores session datausers- User authentication (optional)personal_access_tokens- API tokens (optional)
Configure Cache
The default No additional setup needed. For Redis caching, see the Configuration Guide.
.env uses database caching:Fetch Initial Exchange Rates
Populate the database with current exchange rates:Expected output:
This command scrapes all four banks and stores their current rates. It may take 10-30 seconds depending on network speed.
Verify Installation
Test API Endpoint
Check Database
Test Specific Bank
Post-Installation
Set Up Scheduled Tasks
To automatically update rates, configure the Laravel scheduler: Linux/macOS:Configure Logging
Logs are stored instorage/logs/laravel.log. To monitor:
Optional: Install Node Dependencies
If you plan to customize frontend assets:Common Installation Issues
Composer install fails
Composer install fails
Problem: Composer can’t install dependenciesSolutions:
- Update Composer:
composer self-update - Clear Composer cache:
composer clear-cache - Increase memory limit:
php -d memory_limit=-1 $(which composer) install - Check PHP version:
php -v(must be 8.2+)
Migration fails
Migration fails
Problem:
php artisan migrate returns errorsSolutions:- Verify database connection in
.env - Test connection:
php artisan tinkerthenDB::connection()->getPdo(); - Check database exists:
mysql -u root -pthenSHOW DATABASES; - For SQLite: Ensure
database/database.sqliteexists and is writable - Reset migrations:
php artisan migrate:fresh(WARNING: deletes all data)
Permission denied errors
Permission denied errors
Problem: Laravel can’t write to directoriesSolutions:
rates:update command fails
rates:update command fails
Problem: Scraping command returns errorsSolutions:
- Check internet connection
- Verify cURL extension:
php -m | grep curl - Check logs:
tail -f storage/logs/laravel.log - Test individual bank in tinker:
Port 8000 already in use
Port 8000 already in use
Problem:
php artisan serve failsSolutions:- Use different port:
php artisan serve --port=8080 - Kill existing process:
- Linux/macOS:
lsof -ti:8000 | xargs kill - Windows:
netstat -ano | findstr :8000thentaskkill /PID <pid> /F
- Linux/macOS:
Directory Structure
After installation, your directory structure should look like:Next Steps
Configuration
Configure environment variables and settings
Deployment
Deploy to production
How It Works
Understand the architecture
API Reference
Explore API endpoints