A lightweight, high-performance, and secure native RESTful Notes API built using Modern PHP (Native PDO) and backed by a PostgreSQL database running inside a Docker container.
This project implements strict user isolation via JWT Authentication using a Front Controller routing architecture.
- Zero Heavy Frameworks: Built using pure, modern native PHP.
- Front Controller Architecture: All requests are funneled through a single routing engine (
index.php). - JWT Authentication: User validation and secure stateless token signatures via
firebase/php-jwt. - Data Isolation: Database parameters strictly query user IDs to prevent cross-account leaks.
- Language: PHP 8.2+
- Database Driver: PDO (PostgreSQL Extension)
- Database: PostgreSQL 16 (Dockerized)
- Package Manager: Composer
git clone https://github.com/chriscarias/notes-api-php.git
cd notes-api-phpPull down the required secure cryptographic JWT libraries using Composer:
composer installCreate a .env file in the root directory:
Code snippet
DB_HOST=127.0.0.1
DB_PORT=5433
DB_NAME=notes_db
DB_USER=user
DB_PASS=password
JWT_SECRET=super_secret_key
php -S 127.0.0.1:8001The API will be live and listening for network requests at http://127.0.0.1:8001/index.php.