Welcome to the Finance Control API, a powerful tool for managing your financial records with ease. This API allows you to track income and expenses, generate balance reports, and visualize your financial health.
- User authentication
- Record income and expenses
- View detailed financial entries
- Generate balance reports
- Visualize financial data with charts
- Comprehensive API documentation with Swagger
- PHP >= 7.4
- Composer
- MySQL
- Laravel
-
Clone the repository:
git clone https://github.com/your-username/finance-control-api.git cd finance-control-api
-
Install dependencies:
composer install
-
Copy the environment file and configure it:
cp .env.example .env
Update the
.env
file with your database and other configurations. -
Generate application key:
php artisan key:generate
-
Run the database migrations:
php artisan migrate
-
Install the CORS package:
composer require fruitcake/laravel-cors php artisan vendor:publish --provider="Fruitcake\\Cors\\CorsServiceProvider"
-
Configure CORS: Edit the
config/cors.php
file to allow appropriate origins and methods. -
Run the application:
php artisan serve
-
Install L5-Swagger:
composer require darkaonline/l5-swagger
-
Publish Swagger configuration:
php artisan vendor:publish --provider "L5Swagger\\L5SwaggerServiceProvider"
-
Generate Swagger documentation:
php artisan l5-swagger:generate
Navigate to /api/documentation
in your browser to view the interactive API documentation.
Here are some of the key API endpoints:
- User Login:
POST /api/login
- Register Income:
POST /api/income
- Register Expense:
POST /api/expense
- Get Balance by User ID:
GET /api/balance/{userId}
curl -X POST "http://localhost:8000/api/income" \
-H "Content-Type: application/json" \
-d '{
"type": "Salary",
"amount": 500,
"date": "2024-05-01",
"invoice": "/path/to/invoice.jpg",
"user_id": 1
}'
The API documentation is generated using Swagger. You can access the documentation by navigating to:
http://localhost:8000/api/documentation
For the deployed version, visit:
https://financesystem-production.up.railway.app/api/documentation
POST /api/income
- Register a new incomeGET /api/income/{userId}
- Get income by user IDPUT /api/income/{id}
- Update an existing income recordDELETE /api/income/{id}
- Delete an income record
POST /api/expense
- Register a new expenseGET /api/expense/{userId}
- Get expense by user IDPUT /api/expense/{id}
- Update an existing expense recordDELETE /api/expense/{id}
- Delete an expense record
GET /api/balance/{userId}
- Get balance by user ID
POST /api/login
- User loginPOST /api/register
- User registration
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature
). - Open a pull request.
This project is licensed under the CCO License - see the LICENSE file for details.