Skip to content

rkshaw/php-dynamic-route-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP API PSR-4 Demo

Features:

  • PSR-4 autoloading
  • Dynamic router (auto-load controllers by path)
  • JWT Auth (login issues token)
  • Auth middleware + Exception middleware
  • PDO Database service (configure DB in app/Config/config.php)
  • Product CRUD (id,name,size,is_available)
  • Custom action routing: /api/{controller}/{customMethod}
  • Swagger annotations (swagger.php + app/Docs/*.php)

Setup:

  1. Unzip into your htdocs (e.g., D:/xampp/htdocs/php-api-psr4)
  2. Run: composer install
  3. Create database and table (see app/Config/sql.sql)
  4. Adjust DB credentials in app/Config/config.php
  5. Start Apache or run: php -S localhost:8000 -t public
  6. Access API via: http://localhost/php-api-psr4/public/api/products

About

A custom designed PHP API which supports dynamic controller and action pointing with authentication

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published