Created
January 8, 2013 15:02
-
-
Save dubrod/4484444 to your computer and use it in GitHub Desktop.
Setting Up and API in PHP for those of us awesome developers using SADO. http://www.shayanderson.com/projects/sado-php-orm.htm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//bootstrap | |
require_once 'lib/Sado/sado.bootstrap.php'; | |
//pre-qualify | |
if(function_exists($_GET['method'])){ | |
$_GET['method'](); | |
} | |
//methods | |
function getAllUsers(){ | |
//connect | |
$db = &SadoFactory::getInstance(); | |
$users = $db->selectBuilder() | |
->select('*') | |
->from('users') | |
->get(); | |
$users = json_encode($users); | |
echo($users); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is my first API. I learned the basics from this YouTube Video. Very quick easy script for sharing your Public data. https://www.youtube.com/watch?v=F5pXxS0y4bg