Recommend this page to a friend! |
Download .zip |
Info | Example | View files (23) | Download .zip | Reputation | Support forum | Blog (1) | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2023-11-06 (2 months ago) | Not yet rated by the users | Total: 75 This week: 2 | All time: 10,117 This week: 45 |
Version | License | PHP version | Categories | |||
bank_api-php 1.0.0 | MIT/X Consortium ... | 8 | User Management, Web services, Finances, P... |
<?php |
Ejemplo de una api rest simple para un banco
| Metodo | Endpoint | Descripcion |--------|----------|-----------| | GET | /api/docs | Documentacion en swagger | | GET | / | Alias de /api/docs | | GET | /api/users/ | Obtener todos los usuarios | | POST | /api/users/ | Crear un nuevo usuario | | GET | /api/users/{id} | Obtener un usuario por su id | | PUT | /api/users/{id} | Actualizar un usuario | | DELETE | /api/users/{id} | Eliminar un usuario | | POST | /api/users/login/ | Obtiene la informacion del usuario si los datos son correctos | POST | /api/users/{id}/withdraw | Retira una cantidad de un usuario | GET | /api/users/{id}/transactions | Obtener todas las transaciones de un usuario | GET | /api/transactions/{id} | Obtener un transacion por su ID | | POST | /api/transactions/ | Crear una nueva transacion
Clona esta repositorio
git clone https://github.com/Mateodioev/bank_api-php.git
cd bank_api-php
Levanta el servicio con docker
docker compose up -d
Ve a la documentacion
http://localhost:8080/api/docs
> Puedes cambiar el puerto en el archivo .env
Clona esta repositorio
git clone https://github.com/Mateodioev/bank_api-php.git
cd bank_api-php
Instalar la base de datos
Crea un nuevo usuario de mysql y una db
mysql -u root -p
CREATE USER 'tu_usuario'@'localhost' IDENTIFIED BY 'contraseņa';
CREATE DATABASE bank_example;
GRANT ALL PRIVILEGES ON bank_example . * TO 'tu_usuario'@'localhost';
FLUSH PRIVILEGES;
Crea las tablas segun las tablas del archivo `db.sql`
Crea los archivos de configuracion `.env` y `.htaccess`
cp example.htaccess .htaccess
cp example.env .env
Luego edita el archivo .env segun tus datos
Files |
File | Role | Description | ||
---|---|---|---|---|
public (2 files) | ||||
src (2 files, 3 directories) | ||||
.editorconfig | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
db.sql | Data | Auxiliary data | ||
docker-compose.yml | Data | Auxiliary data | ||
Dockerfile | Data | Auxiliary data | ||
example.env | Data | Auxiliary data | ||
example.htaccess | Data | Auxiliary data | ||
index.php | Example | Example script | ||
readme.md | Doc. | Documentation | ||
thunder-collection_bankApi.json | Data | Auxiliary data |
Files | / | public |
File | Role | Description |
---|---|---|
openapi.yaml | Data | Auxiliary data |
swagger.html | Doc. | Documentation |
Files | / | src |
File | Role | Description | ||
---|---|---|---|---|
Controllers (3 files) | ||||
Db (2 files) | ||||
Models (4 files) | ||||
helpers.php | Aux. | Auxiliary script | ||
Routes.php | Class | Class source |
Files | / | src | / | Controllers |
File | Role | Description |
---|---|---|
baseController.php | Class | Class source |
TransactionController.php | Class | Class source |
UserController.php | Class | Class source |
Files | / | src | / | Db |
File | Role | Description |
---|---|---|
Sql.php | Class | Class source |
SqlException.php | Class | Class source |
Files | / | src | / | Models |
File | Role | Description |
---|---|---|
Error.php | Class | Class source |
Success.php | Class | Class source |
Transaction.php | Class | Class source |
User.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.