Skip to content

codingspook/rest-api-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Template 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. Installa le dipendenze (se non giΓ  fatto):
composer install
  1. Configura il web server per puntare alla directory public/

Struttura del Progetto

nome-progetto/
β”œβ”€β”€ config/
β”‚   └── cors.php         # Configurazione CORS
β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ users.php        # Definizione route per la risorsa utenti
β”‚   └── index.php        # Definizione route
β”œβ”€β”€ public/
β”‚   └── index.php        # Entry point
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ bootstrap.php    # Bootstrap dell'applicazione
β”‚   β”œβ”€β”€ Models/
β”‚   β”‚   β”œβ”€β”€ BaseModel.php       # Classe BaseModel
β”‚   β”‚   └── User.php            # Esempio model
β”‚   └── Utils/
β”‚       β”œβ”€β”€ DB.php              # Classe DB
β”‚       β”œβ”€β”€ 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