Files
elixforms-web-services/struttura-soluzione.txt
T

53 lines
1.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/var/www/html/api/
├── public/
│ └── index.php
├── src/
│ ├── Controllers/
│ │ ├── V1/
│ │ │ └── UsersController.php
│ │ └── ExampleController.php
│ │
│ ├── Services/
│ │ └── ExternalApiService.php
│ │
│ ├── Core/
│ │ ├── Router.php
│ │ ├── Request.php
│ │ ├── Response.php
│ │ ├── Config.php
│ │ ├── HttpClient.php
│ │ ├── LoggerFactory.php
│ │ └── RateLimiter/
│ │ ├── RateLimiterInterface.php
│ │ ├── FileRateLimiter.php
│ │ └── InMemoryRateLimiter.php
│ │
│ └── Helpers/
│ └── Json.php
├── config/
│ ├── config.php
│ ├── config.php.template
│ ├── secrets.php
│ └── secrets.php.template
├── tests/
│ └── Unit/
│ └── RateLimiterTest.php
├── composer.json
└── .gitignore
Piccoli accorgimenti operativi
Permessi: la cartella di storage per il rate limiter deve essere scrivibile dallutente Apache (www-data o apache).
Sicurezza: non loggare mai i segreti; filtra i campi sensibili prima di loggare.
Performance: filebased va bene per carichi moderati; se il traffico cresce, sostituisci FileRateLimiter con una soluzione in memoria/distribuita.
Error handling: centralizza gestione eccezioni e ritorna JSON coerente con codici HTTP.
Versioning: quando aggiungi V2, crea src/Controllers/V2/... e registra le rotte nello stesso modo; il router selezionerà la versione corretta.