A CodeIgniter Framework Parse Library
- User Registration
- User Logout
- User Update
- More Error details
Parse PHP SDK needs default session, so if you use CodeIgniter's Session Library I recommend you use PHP Native Session and let Parse PHP SDK initialize it.
I created a CodeIgniter Native Session Library to it.
To use Native Session Library with Parse Library in CodeIgniter's Autoload Configuration you need to put first 'parse' and after 'native_session'.
- Download Parse PHP SDK.
- Create a folder named parse on project main folder.
- Put Parse PHP SDK files into parse folder.
- (Optional) If you want to use Parse Library in all files or many files, I recommend you add it on CodeIgniter's Autoload Configuration.
$className = 'Book';
$newBook = $this->parse->newObject($className);
- This retrieves a native Parse Object. So you can use normally how you know.
$newBook = $this->parse->newObject($className);
$this->parse->save($newBook);
$className = 'Book';
$bookId = 'jsad71ASdj';
$book = $this->parse->get($className, $bookId);
// find obects normally
$className = 'Author';
$equalToArray = array(
'active' => TRUE,
);
$ascending = 'name';
$descending = 'null';
$limit = 10;
$skip = 5;
$includeArray = array(
'country',
);
$authorsResultsArray = $this->parse->find($className, $equalToArray, $ascending, $desceding, $limit, $skip, $includeArray);
// passing Parse Object in equalToArray
$firstAuthor = $authorsResultsArray[0];
$className = 'Book';
$equalToArray = array(
'author' => $firstAuthor,
);
$ascending = 'publishDate';
$descending = 'null';
$limit = null;
$skip = null;
$includeArray = array();
$booksResultsArray = $this->parse->find($className, $equalToArray, $ascending, $desceding, $limit, $skip, $includeArray);
- Like find() but without $limit param.
// (...)
$firstAuthor = $authorsResultsArray[0];
$className = 'Book';
$equalToArray = array(
'author' => $firstAuthor,
);
$ascending = 'publishDate';
$descending = 'null';
$skip = null;
$includeArray = array();
$firstBook = $this->parse->first($className, $equalToArray, $ascending, $desceding, $skip, $includeArray);
$username = 'example';
$password = 'example';
$user = $this->parse->userLogin($username, $password);
$user = $this->parse->getCurrentUser();