Skip to content

jmas/plain-php-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plain PHP API

It is very "sportan" list of PHP functions for creating API service that using MySQL as data base.

db()

Get current PDO connection. DB settings is stored in config.php file.

$sql = 'SELECT * FROM user';

$sth = db()->prepare($sql);

if ($sth->execute()) {
	$response['result'] = $sth->fetchAll();
}

config($key=null)

Get config values for specific key. Config values is stored in config.php file. For local enviroment you can use config.local.php.

$dbConfig = config('db');
$allConfigs = config();

currentPath()

Get current path of requested URL. Eg. for URL http://localhost/index.php/api currentPath() will be api.

$path = currentPath();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages