A Laravel application for fetching and caching BIN (Bank Identification Number) information using multiple providers. This project implements an adapter pattern to support various BIN lookup services and optimizes queries with caching.
- Multiple BIN Providers: Supports integration with multiple BIN lookup services.
- Caching: Caches BIN information to reduce the number of external API calls.
- Flexible and Extensible: Easily add or disable BIN providers.
- RESTful API: Expose endpoints for fetching BIN information and managing providers.
- Database Seeding: Pre-populates the database with initial provider data.
- Unit and Feature Tests: Comprehensive test coverage using Pest.
-
Clone the repository:
git clone https://github.com/Perafan18/bin-finder.git
-
Navigate to the project directory:
cd bin-finder
-
Install dependencies:
./vendor/bin/sail up -d ./vendor/bin/sail composer install
-
Copy the example environment file and set up your environment variables:
cp .env.example .env
-
Generate an application key:
./vendor/bin/sail artisan key:generate
-
Run the database migrations and seeders:
./vendor/bin/sail artisan migrate --seed
Add your BIN lookup service API keys to the .env
file:
BIN_CODES_API_KEY=your_bincodes_api_key
BIN_CHECK_API_KEY=your_bincheck_api_key
GREIP_API_KEY=your_greip_api_key
IINLIST_API_KEY=your_iinlist_api_key
Start the Laravel development server:
./vendor/bin/sail up
Execute the test suite using Pest:
./vendor/bin/sail test
Run Laravel Pint to ensure code quality and consistency:
./vendor/bin/sail artisan pint
To generate the Swagger documentation, run the following command:
./vendor/bin/sail artisan l5-swagger:generate
The application exposes the following endpoints:
GET /api/bin/{bin}
: Fetch BIN information for the given BIN.GET /api/providers
: List all BIN providers.POST /api/providers/{provider}/toggle
: Enable or disable a BIN provider.GET /api/documentation
: View the Swagger documentation
Contributions are welcome! Please submit issues or pull requests for improvements and bug fixes.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
This project is open-source and available under the MIT License.