Skip to content

codingspook/simple-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Simple Rest API

Template minimale per creare backend REST API in PHP

Installazione

Tramite Composer create-project

composer create-project codingspook/simple-rest-api nome-progetto

Setup iniziale

  1. Configura il web server per puntare alla directory public/ (se non Γ¨ giΓ  configurato)

  2. Configura la connessione al database in config/database.php

  3. Configura il CORS in config/cors.php

  4. Configura le route in routes/index.php

Struttura del Progetto

nome-progetto/
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ database.php     # Configurazione database
β”‚   └── cors.php         # Configurazione CORS
β”œβ”€β”€ routes/
β”‚   └── index.php        # Definizione route
β”œβ”€β”€ public/
β”‚   └── index.php        # Entry point
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ bootstrap.php    # Bootstrap dell'applicazione
β”‚   β”œβ”€β”€ Database/
β”‚   β”œβ”€β”€ β”œβ”€β”€ DB.php              # Classe DB
β”‚   β”‚   └── JSONDB.php          # Classe JSONDB
β”‚   β”œβ”€β”€ Models/
β”‚   β”‚   └── BaseModel.php       # Classe BaseModel
β”‚   └── Utils/
β”‚       β”œβ”€β”€ Request.php         # Classe Request
β”‚       └── Response.php        # Gestione risposte JSON
β”œβ”€β”€ composer.json        # Dipendenze Composer
└── README.md           # Questo file

Comandi Utili

# Installa dipendenze
composer install

# Aggiorna autoload dopo aggiunta classi
composer dump-autoload

# Avvia server di sviluppo (PHP built-in)
php -S localhost:8000 -t public

Licenza

MIT

Supporto

Per domande o problemi, consulta la documentazione o apri una issue sul repository.


Buon coding! πŸš€

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages