https://github.com/aandersonsantos/library-system
API Library-System
https://github.com/aandersonsantos/library-system
php sqlite
Last synced: 3 months ago
JSON representation
API Library-System
- Host: GitHub
- URL: https://github.com/aandersonsantos/library-system
- Owner: AAndersonSantos
- Created: 2024-10-31T21:40:53.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-11-01T05:35:24.000Z (7 months ago)
- Last Synced: 2025-01-23T08:16:43.490Z (4 months ago)
- Topics: php, sqlite
- Language: PHP
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Library System
A library management system developed in PHP.
## Table of Contents
- [Description](#description)
- [Requirements](#requirements)
- [Cloning the Repository](#cloning-the-repository)
- [Installing Dependencies](#installing-dependencies)
- [Running Unit Tests](#running-unit-tests)## Description
The Library System is a project that allows for the simple and efficient management of books and users. The system provides functionalities to add, list, and remove books and users.
## Requirements
Before you begin, you will need to have the following installed on your system:
- PHP 8.0 or higher
- Composer
- PDO (for database access)
- SQLite (the project uses an SQLite database)## Cloning the Repository
To clone this repository, open the terminal and run the following command:
```bash
git clone https://github.com/AAndersonSantos/Library-System.git
```## Installing Dependencies
Navigate to the project directory and run the following command to install the required dependencies:
```bash
cd library-system
composer install
```## Database Setup
The project uses an SQLite database. To set it up, follow these steps:
1. Create a file named database.sqlite inside the src folder.
2. Ensure that the file has read and write permissions.## Running the Project
To start the built-in PHP server and run the project, use the following command:
```bash
php -S localhost:8000 -t src
```## Running Unit Tests
To run the unit tests for the project, use PHPUnit. Make sure you are in the project directory and run the following command:
```bash
vendor/bin/phpunit tests
```The tests will be executed, and you will see the results in the terminal.
## Endpoints
You can access the following endpoints to test the routes using Postman or any API testing tool:
Books:
GET: http://localhost:8000/index.php/livros
POST: http://localhost:8000/index.php/livros
PUT: http://localhost:8000/index.php/livros/{id}
DELETE: http://localhost:8000/index.php/livros/{id}
Users:
GET: http://localhost:8000/index.php/usuarios
POST: http://localhost:8000/index.php/usuarios
PUT: http://localhost:8000/index.php/usuarios/{id}
DELETE: http://localhost:8000/index.php/usuarios/{id}
Loans:
POST: http://localhost:8000/index.php/emprestimos