Sample of REST API build with native PHP.
Use PDO to manipulate MySQL database.
There also sample of client that access the API.
Configure url in .htaccess based with your path
RewriteRule ^(.*)$ /nativerest/api/index.php
Configure url in the client code based with API url
$url = 'http://localhost:8080/NativeREST/api/barang';