You should consider looking at https://developer.okta.com/blog/2019/03/08/simple-rest-api-php#create-the-php-project-skeleton-for-your-rest-api